Skip to content
TORNLIFE More

JotDe: forum

JotDe [2200962] Level 91

Forum posts (Torn's count)
57 observed
Archived posts
23
Threads started (archived)
4

Boards

From the 23 newest archived posts.

Threads started

Most-liked posts

Likes as archived at fetch time, adjusted for how long each post had been up. Scored posts only; the full score pass runs after the import.

[Site] Torn Api - OpenAPI3.0 · · 11 likes

I created a OpenAPI 3.0 description of the current Torn API.
I'm running it with swagger-ui on my Server, if you want to try it out.

Swagger-UI
https://jotde.be/torn-api/

git-project
https://github.com/torn-api/openapi

For further description read the README.md in the git-project.

Sea Men - Creamed the competition · · 14 likes

First of all, I want to thank all Sea Men who don't have big names. Because in the end you carried us to victory.

Next I come to individuals who were mainly active during the Europe period.

Gloin the little beast from my faction for his great achievement.
XAsukaX for the "night shifts" and the daily greeting of the European players.
WhackadillyWoo, who gave me the confidence to do the countdown myself as a temporary cum captain.
Natty_Boh, as the leader of our bounty train who successfully took our low levels out of the game.
Tipsy, as our "night shift" strategist who accompanied us until Stretch woke up again.
Stretch that everyone knows and appreciates.

And finally Ishtar who promised kisses to everyone if Total Bankers had survived until she was awake. Unfortunately, she fell asleep again and Totaler Bankers were eliminated.

Certain people lagging badly · · 2 likes

If possible, get some mySql Admin/Expert to analyse this situation in the DBMS Logs.
My experience with execution spikes were always configuration problems of the DBMS.
For example a to small Undo-Log or the Optimizer/Statistics Analyzer is running in a bad time or gets too few memory.

Probally it is not a problem with a inperformant DML or bad Index. Because in this case you would get slowly increasing execution times or always long execution times.

Wish you the best luck and a really good sql admin.

Torn Error to HTTP Status Code Snippet (Python) · · 2 likes

For a while now, I've been bothered by the way the API reports errors.
So I thought about how a general mapping function could look like to encapsulate the design flaw.
I think in other dynamic languages the mapping can be used almost the same way.

If they ever change the API to the http standard, the function is robust and will not break.

I had to remove the source, because the forum does not preserve the spaces.
Here is the working fiddle.

Just replace the 2 value in the env-vars with your api-key.

Back Button doesn't work properly in Laptop · · 0 likes

Firefox on PC with Linux Ubuntu 18.04

1. Being abroad
2. Click Laptop
[image: i.imgur.com]

3. Click "Job Listing"
[image: i.imgur.com]

4. Click "Back"
[image: i.imgur.com]
5. "Home"-Screen is loading with destroyed Style instead of the Newspaper
[image: i.imgur.com]

Recent archived posts

Looking for Work? Post your Stats here ·

job found

Bakedtradesman revive service ·

Revive very nice!

Elimination Meme Competition · · 5 likes

Elim is over, now I can post my Memes. :)

[image: i.imgur.com][image: i.imgur.com]

Sea Men - Creamed the competition · · 14 likes

First of all, I want to thank all Sea Men who don't have big names. Because in the end you carried us to victory.

Next I come to individuals who were mainly active during the Europe period.

Gloin the little beast from my faction for his great achievement.
XAsukaX for the "night shifts" and the daily greeting of the European players.
WhackadillyWoo, who gave me the confidence to do the countdown myself as a temporary cum captain.
Natty_Boh, as the leader of our bounty train who successfully took our low levels out of the game.
Tipsy, as our "night shift" strategist who accompanied us until Stretch woke up again.
Stretch that everyone knows and appreciates.

And finally Ishtar who promised kisses to everyone if Total Bankers had survived until she was awake. Unfortunately, she fell asleep again and Totaler Bankers were eliminated.

Place your bets (Seaman vs VS) 1 random DP winner ·

nothing has been decided yet.

Place your bets (Seaman vs VS) 1 random DP winner · · 1 like

Bet on Sea Men - Best Men

Seamen or Secrets ? · · 9 likes

Torn Error to HTTP Status Code Snippet (Python) ·

response.raise_for_status() throws/raises an HTTPError.
This is the nice thing in this example. You don't have to care if it is a clouflare error or a torn error. :)

Torn Error to HTTP Status Code Snippet (Python) · · 2 likes

For a while now, I've been bothered by the way the API reports errors.
So I thought about how a general mapping function could look like to encapsulate the design flaw.
I think in other dynamic languages the mapping can be used almost the same way.

If they ever change the API to the http standard, the function is robust and will not break.

I had to remove the source, because the forum does not preserve the spaces.
Here is the working fiddle.

Just replace the 2 value in the env-vars with your api-key.

[Site] Torn Api - OpenAPI3.0 ·

First Example for User -> Networth is ready.
Had some work to do with refactoring from on big yaml file to smaller files.

Also I moved the repository to github and created the organization torn-api.

[image: i.imgur.com]

[Site] Torn Api - OpenAPI3.0 ·

The documentation is not complete. In addition, there are no examples or structure descriptions for the responses. As I said, I will maintain this in the next few days.

[Site] Torn Api - OpenAPI3.0 ·

It's still a work in progress. But I have already published it now, so that you can get a first impression and to get helpers on board. My previous attempts to use the description language as a possible documentation base have failed due to subsequent tool discussions in the Discord API channel.

[Site] Torn Api - OpenAPI3.0 ·

I have noticed that very few people know the term OpenAPI. So here is the description of what OpenAPI is.

The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.
An OpenAPI definition can then be used by documentation generation tools to display the API, code generation tools to generate servers and clients in various programming languages, testing tools, and many other use cases.


In the next days I will maintain examples of the API's responses and record the structure of the responses. If someone wants to join in, I can move the project to github.

[Site] Torn Api - OpenAPI3.0 · · 11 likes

I created a OpenAPI 3.0 description of the current Torn API.
I'm running it with swagger-ui on my Server, if you want to try it out.

Swagger-UI
https://jotde.be/torn-api/

git-project
https://github.com/torn-api/openapi

For further description read the README.md in the git-project.

API status/until for the federal jail ·

Overloading a column with a valid value (999 days in the future) to mark it as permanent is... interesting (code smell)
This design decision is a potential root cause for a hard to find bug.

Two Design possiblities for this case:

- add a state "Federal Permanent"
- use a negative value (e.g. -1) in the until column

Please Teach Me how to use the API ·

If you want to build a basic understanding, read one of the following sources.
https://www.restapitutorial.com/

http://restcookbook.com/

If you just want to use the api, go for a quick example of a HTTP GET Request in the language you want to use plus a well known json parser in your language. Don't try to parse the response by yourself.

If you want to go further, than following URL is a great resource for everything about Web Technology.
https://developer.mozilla.org/

Certain people lagging badly · · 2 likes

If possible, get some mySql Admin/Expert to analyse this situation in the DBMS Logs.
My experience with execution spikes were always configuration problems of the DBMS.
For example a to small Undo-Log or the Optimizer/Statistics Analyzer is running in a bad time or gets too few memory.

Probally it is not a problem with a inperformant DML or bad Index. Because in this case you would get slowly increasing execution times or always long execution times.

Wish you the best luck and a really good sql admin.

Include the error code as a custom HTTP header ·

I can only say that it is not good practice to return a 404 status code to a human. Not everyone deals extensively with the things you should do and things you can do. Look at the big frameworks. Usually the undefined errors are caught by middleware and converted to an HTTP 200.

Include the error code as a custom HTTP header ·

You must distinguish between human users and machines.
Humans can do little with technical errors that are incomprehensible to them.
That is why there are usually only 2xx or 3xx status codes.

For an API that is developed for machines, the HTTP status code is just the right thing.
Because the HTTP Status Code is internationally standardized and machines love structured and standardized data. In addition, the semantics of the status codes are already described.
This reduces the effort for Torn developers, because everything has already been described by the IETF. They would only have to use it.
See https://tools.ietf.org/html/rfc7231#section-6.1

Include the error code as a custom HTTP header · · 1 like

No need for custom HTTP Headers.
HTTP Status Code is the thing they should use.

HTTP 500 => 0 => 'Unknown error' : Unhandled error, should not occur.
HTTP 400 => 1 => 'Key is empty' : Private key is empty in current request.
HTTP 400 => 2 => 'Incorrect Key' : Private key is wrong/incorrect format.
HTTP 400 => 3 => 'Wrong type' : Requesting an incorrect basic type.
HTTP 400 => 4 => 'Wrong fields' : Requesting incorrect selection fields.
HTTP 429 => 5 => 'Too many requests' : Current private key is banned for a small period of time because of too many requests (max 100 per minute).
HTTP 400 => 6 => 'Incorrect ID' : Wrong ID value.
HTTP 403 => 7 => 'Incorrect ID-entity relation' : A requested selection is private (For example, personal data of another user / faction).
HTTP 403 => 8 => 'IP block' : Current IP is banned for a small period of time because of abuse.
HTTP 503 =>9 => 'API disabled' : Api system is currently disabled.
HTTP 403 => 10 => 'Key owner is in federal jail' : Current key can't be used because owner is in federal jail.
HTTP 403 => 11 => 'Key change error: You can only change your API key once every 60 seconds'.
HTTP 500 => 12 => 'Key read error: Error reading key from Database'.