API Traccar C#

greetings I'm trying to send the location from a program in c # Which I'm using this code through the GET method the program runs perfect and is sending me an exact location in the code. and I'm not really sure if this is compatible with the Traccar API

this is a parter of the code and manage to authenticate me

var positionData = new
{
    latitude,
    longitude,
    deviceId = 136,
    timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
};

var positionUrl = $"{serverUrl}api/positions?deviceId={positionData.deviceId}&latitude={positionData.latitude}&longitude={positionData.longitude}&timestamp={positionData.timestamp}";
var response = await httpClient.GetAsync(positionUrl);

Console

PS F:\MyLocation> dotnet run

Location sent successfully.

It is possible to send the location or touch to make a connection protocol that simulates the GPS

Anton Tananaeva year ago

Can you please provide a link where you found this API.

I'm developing there is no link I share all the code?

Anton Tananaeva year ago

I'm not asking for your code. I'm asking where you found this API endpoint. Surely it's not just a random guess.

I am guided by the documentation https://www.traccar.org/traccar-api/

if I had it wrong change it to this code

var positionUrl = $"{serverUrl}api/positions/";
var content = new FormUrlEncodedContent(new Dictionary<string, string>
{
    { "deviceId", positionData.deviceId.ToString() },
    { "latitude", positionData.latitude.ToString() },
    { "longitude", positionData.longitude.ToString() },
    { "timestamp", positionData.timestamp.ToString() }
});
var response = await httpClient.GetAsync(positionUrl);
Anton Tananaeva year ago

There's no API to add a position, so what you're trying to do won't work using the API. Instead you should use one of the protocols. For example OsmAnd.

if I already imagined it I thought it also works then thank you very much for your help friend Anton I'm going to do what I say and implement a connection protocol

ready friend anton and manage to report the location through the Osmand protocol

At the moment it is only to send a static location

Description text

Description text

thank you very much for your help