You have to include "Accept" header in the request.
<script type="text/javascript">
var name = "admin";
var uid = "admin";
$.ajax({
type: 'get',
url: 'http://localhost:8082/api/positions/',
headers: {
"Authorization": "Basic " + btoa("username" + ":" + "password")
},
contentType: "application/json",
data: JSON.stringify({
name: name,
uniqueId: uid
}),
success: function (response) {
console.log(response);
}
});
</script>
this is my request
I don't see any "Accept" header in your request. Please read my previous comment.
Im kind of new in these types of request. could you give me an example of a correct request please? it will be much apreciated!! thx!!
may be this link can help https://github.com/tananaev/traccar/issues/2890
yeah thanks it worked, but now it shows the following error:
HTTP 401 Unauthorized - WebApplicationException (SecurityRequestFilter:103 < ...)
sorry for the trouble and thanks in advance.
I think the error message is pretty self-explanatory. You are not authorized. You have to either have a logged-in session cookie, or use basic authorization header.
HTTP 401 Unauthorized - WebApplicationException (SecurityRequestFilter: 108 < ...)
I have found a much easier way to pass it:
http[s]://user:password@traccar .com/api/positions
it works :)
Hi, im new using the traccar api and i have a problem
i have a local traccar server running in my pc it tracks fine via the web client, but when i try to enter to
http://localhost:8082/api/positions/ it shows an error saying "ERR_INVALID_RESPONSE"
yet i try that direction in the demo of traccar and it works.
help what im doing wrong