Request user data by id

Sousa Martins 8 years ago

i try.
server.com:8082/api/users <- List all : OK
server.com:8082/api/users/id/2 <- HTTP 404 Not Found - NotFoundException (...)
server.com:8082/api/users/id:2 <-
server.com:8082/api/users/id?2 <-
server.com:8082/api/userid/2 <-
server.com:8082/api/usersid/2<-
server.com:8082/api/userid:1

How i can get data of a especific user?
Thanks...

Anton Tananaev 8 years ago

There is no API to get user by id. You can only list all users.

Sousa Martins 8 years ago

Thanks... to delete a user i trying

server.com:8082/api/delete/users/3
server.com:8082/api/users/delete?userid=3
server.com:8082/api/users/delete/3
But nothing works

Sorry if the questions are very basic, but I still do not understand very well how the request can be made properly.

https://www.traccar.org/api-reference/#operation--users--id--delete

Before u ask.... My traccar version is 3.15

Anton Tananaev 8 years ago

It seems like you completely ignored what documentation says. You have to send DELETE request to the following endpoint:

server.com:8082/api/users/3

Sousa Martins 8 years ago
<form method="post" action="http://server:8082/api/users/3"><br>
            <input type="text" name="act" value="DELETE">           
            <button type="submit" >Save</button>
        </form>

Thanks for the attention, this is the first time I'm using api. I'm starting yet in this server test. But would that be the requisition?

Anton Tananaev 8 years ago

It's not possible to send DELETE with form. Also, your form method still says POST and not DELETE.

You need to use AJAX.