Creating Drivers using non-traccar UI

St Iyke Ndubuisi4 years ago

Hello,
I'm trying to create drivers in the traccar database using a front-end form, nodejs and mysql query to insert the form-data into the traccar.tc_drivers table.

The data is inserted successfully. However, the newly added driver is not visible in the traccar UI even though the data is there in the database table.

What am I missing? Any insights?

Tony Shelver4 years ago

I am sure other's will chime in, but you really want to use the UI for any updates.

Anton Tananaev4 years ago

You have to use the API instead of inserting data directly into the database.

St Iyke Ndubuisi4 years ago

Thanks Anton. I'll do that.

St Iyke Ndubuisi4 years ago

Hi Anton,
I'm working on the POST API request, I'm getting 'http 415 Unsupported Media Type'. I believe this indicates I have the encoding wrong. Below is a screenshot from Postman. I've tried form-data, x-www-form-urlenconded and raw with the same results. Appreciate direction on properly setting up the POST request. I've searched the forum and didn't find any similar issue

Postman screenshot: (https://drive.google.com/file/d/1vUhO13-scVS_GZmVyLv85MBAITZn-Uk4/view?usp=sharing)

GET requests work fine.

Anton Tananaev4 years ago

I'm a bit confused. Why are you trying to use form when API documentation clearly specifies JSON format?

St Iyke Ndubuisi4 years ago

Anton,
Thanks. My bad. It worked with content-type: application/json .

Thanks !