Traccar Api call fail

Mohamed Elaggouni 7 years ago

I tried the web app with my traccar demo server in : https://github.com/traccar/traccar-web/tree/master/web/simple and it worked well
but when I make a simple call in Postman : http://demox.traccar.org/api/session?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I get error: HTTP 404 Not Found - WebApplicationException (SessionResource:95 < ...)
the same token is used in the simple web and in the api call
Is there somthing wrong with my api call?
regards,

Anton Tananaev 7 years ago

Compare your call with what web app sends.

Mohamed Elaggouni 7 years ago

Thank you fo ranswering me
I logged the calls of the web app to the console and I get these :
http://demo3.traccar.org/api/server
http://demo3.traccar.org/api/session?token=xxxxxxxxxxxxxxxxxxxxxxxxxxx
http://demo3.traccar.org/api/devices
I executed these queries in Postman: the first worked well , the second with token I get HTTP 404 Not Found
I seperated the second and executed it alone in a javascript script and it worked well but not in postman or react native script
what can be the problem
this is important because Iam ptryign to create a mobile app for traccar

Anton Tananaev 7 years ago

You need to look at other request parameters (e.g. method), not just the URL.

Mohamed Elaggouni 7 years ago

It is GET method, in addition to that I took the ssame method "ajax" from the web app, I put it in a react native script and i get 404 erro
It is really intriguing
Do you an example of traccar client with react native

Anton Tananaev 7 years ago

No, I don't have react native example. You are clearly missing something. If the call is exactly the same, you will get the same result. There is no magic.

Mohamed Elaggouni 7 years ago

Do i need to create a session somewhere before makign a call to it with api call? (why calling for server before session in the simpel web app)

Anton Tananaev 7 years ago

I'm a bit confused with this question. Server creates sessions, not client. We call server endpoint to get server configuration. It has nothing to do with user session.

Mohamed Elaggouni 7 years ago

sorry for this question. I used base auth (mail + password) to get devices with the api and it worked well, the only request is not working is session with token. Do I need to have nested call server before session like simple web app

Anton Tananaev 7 years ago

No, you don't. I repeat again, server endpoint call has absolutely nothing to do with session call.

Mohamed Elaggouni 7 years ago

Ok So may be I need to send JSessionId from the cookie and since it is sent automatically with firefox I need to code it for ppostman or other framework
sorry for these questions, I am really trying to understand this part