PDA

View Full Version : No local usage of Trackbase API?



Gulaschkanone
15-10-2022, 16:48
Hello folks,

I currently fiddle with the Trackbase API in general. I've created an account and an application (thus got the relation token and the AKK) and wanted to try it. Unfortunately, I get this error message:


Wrong server url or no access to API.

Since I'm developing a website on my local machine, this sounds like I'm unable to use the API as the request's IP address is checked against the hostname entered in the application.

Can this situation be solved somehow without needing a publicly available server and may I ask why the check for the server is necessary as I have to provide several tokens already anyway?

BTW, returning the status code "200" for an invalid request is kinda misleading :)

JoNny
15-10-2022, 21:13
Hello folks,

I currently fiddle with the Trackbase API in general. I've created an account and an application (thus got the relation token and the AKK) and wanted to try it. Unfortunately, I get this error message:


Wrong server url or no access to API.

Since I'm developing a website on my local machine, this sounds like I'm unable to use the API as the request's IP address is checked against the hostname entered in the application.

Can this situation be solved somehow without needing a publicly available server and may I ask why the check for the server is necessary as I have to provide several tokens already anyway?

BTW, returning the status code "200" for an invalid request is kinda misleading :)

Dear Gulaschkanone,

Thanks for testing our API and asking your questions on this forum.
The TrackBase API can be called from any server or client, no matter the availability or connection.

Therefore, you can use your local machine or development environment as the server address. Please note that it obviously needs to be resolvable by a remote server (TrackBase). Therefore, domains that are not resolvable through public DNS servers are not reachable. Please use your local IP address instead, so TrackBase can track down if the request is coming from that server/machine. Make sure to use http://YO.UR.I.P./ as the format.
The server address needs to be callable only for apps fetching user information.

Also, returning the status code 200 is correct and considered best practice. The request to the API itself was OK and successful. If the request cannot be interpreted or is not holding sufficient information is checked during runtime and returned in the return JSON.

If there's anything else I can help you with, feel free to ask.
Also, if you are running PHP on your machine, you can use our package (https://packagist.org/packages/trackbasenet/dev-api) via composer (composer require trackbasenet/dev-api).

/JoNny

Gulaschkanone
15-10-2022, 21:25
Hello JoNny,

thank you for your response. Sometimes, some solutions seem too obvious. :D
Using my IP address indeed solved the issue.

Kind regards
Gulaschkanone