I’m trying to integrate my app to the SPTrans (a public transportation company) in order to get the public buses’ real time position.
I’m using the Web API component to call a GET method but its returns an error: NetworkError when attempting to fetch resource.
Anyone knows how can I solve this error?
Hi @dougsouzarodrigues5m, welcome to the Community.
Does this API return information when you paste the link into a browser such as Google Chrome?
Hello @eoinparkinson, thanks.
On a browser it returns “Authorization has been denied for this request.”
After some tries I decided using Postman to see what shloud be returned and using Postman it return the buses positions correctly as listed a little sample bellow:
How did you get the data through Postman if it was denied through browser? Do you have an authKey of some description for this to work?
Web API will display what the browser displays (when accessing API). So if the browser is showing Authorisation denied then this would reflect also onto the Web API.
I’m facing the same error just today aswell. Cannot continue coding with this “bug” happening… Is this really a bug? First time happenning to me.
On Postman I was passing one URL like this: http://api.olhovivo.sptrans.com.br/v2.1/Posicao/Linha?codigoLinha=33170 and works.
I got it make it on Thunkable now.
This is an interesting behave to me and I don’t know if it happens with other APIs but even I passing the Authorization token on the header I’ve had to call a POST method passing the token again and then inside the POST method call a GET method to list the buses’ position. On this way works for me on Thunkable.
The blocks structure is:
Sure, this is just for testing the connection and now I’ll deeper and getting the lat and long positions and put them on a map.
Thanks for you help.