cad / vehicle-tracker-api Goto Github PK
View Code? Open in Web Editor NEWVehicle Tracking System Backend
Home Page: https://api.vehicles.neu.edu.tr/docs/
Vehicle Tracking System Backend
Home Page: https://api.vehicles.neu.edu.tr/docs/
According to API documentation (version 1.1.4) you should be able to create a vehicle by POST'ing only plate_id
and type
data but when you try this It returns a bad request (400) error.
When a group is deleted new group with the same name can not be created
Would be nice to be able to unassign an agent from a vehicle.
Swagger based API docs would help client developers very much.
And also a README.md
As we discussed it became clear that using PlateID as the identifier for the
agents would be such a burden to the agent devs since everytime an agent moves
from a vehicle to another vehicle they'd need to reflash the firmware with the
new PlateID.
That's why we've decided to use UUIDs for the agents that will be kept forever
on the agent(unless we need to change id). In order to provide this
we need to create a new endpoint set for /agents/.
Here is the endpoint stub for getting the position from the agent,
that we all have agreed.
HTTP POST https://api.vehicles.neu.edu.tr/agents/<uuid>/sync
{
"lat": "",
"lon": "",
"ts": ""
}
We decided that we should keep /vehicles/ endpoint for query purposes.
That means we'll also need a way to map those agents with vehicles(UUID <-> PlateID).
We need a better cli with dynamic config path definition.
Would be nice to filter for assigned or unassigned agents.
We can manually generate api docs via swagger. But it would be nice to have it done automatically.
There is no filtering option like filtering vehicles with/without agents.
It would be nice to have one :)
WebSocket handler is needed for mobile apps and other real-time systems.
Currently CORS headers are miasing in the responses. We need CORS to work with browser so we should include those headers somehow.
When you try to create a vehicle without agent_uuid
, in a system that has no agents in database (agents are never been created);
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer 23cc0605-a2fc-4cfc-a403-233054625d0c' -d '{ \
"plate_id": "AA111", \
"type": "SCHOOL-BUS" \
}' 'http://localhost:5004/vehicle/'
{
"updated_at": "2017-09-12T14:49:22.938391664+03:00",
"plate_id": "AA111",
"agent": {
"uuid": "",
"updated_at": "0001-01-01T00:00:00Z",
"label": "",
"lat": "",
"lon": "",
"gps_ts": ""
},
"groups": null,
"type": "SCHOOL-BUS"
}
you are able to create a vehicle without an agent assigned to it, an agentless vehicle.
But what you can not do is; when you try to create a vehicle without agent_uuid
, in a system that has at least one agent, you ending up with a vehicle that an agent assigned to it.
For testing, lets create an agent for the first time and call it firstagent
;
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer 23cc0605-a2fc-4cfc-a403-233054625d0c' -d '{ \
"lat": "1111", \
"lon": "1111", \
"ts": "1111" \
}' 'http://localhost:5004/agent/firstagent/sync'
And now when we try to create a vehicle without an agent;
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer 23cc0605-a2fc-4cfc-a403-233054625d0c' -d '{ \
"plate_id": "BB222", \
"type": "SCHOOL-BUS" \
}' 'http://localhost:5004/vehicle/'
{
"updated_at": "2017-09-12T14:59:22.943486352+03:00",
"plate_id": "BB222",
"agent": {
"uuid": "firstagent",
"updated_at": "2017-09-12T14:59:22.941804212+03:00",
"label": "",
"lat": "1111",
"lon": "1111",
"gps_ts": "1111"
},
"groups": null,
"type": "SCHOOL-BUS"
}
it created with the first agent already assigned to it.
PS.: It doesn't matter how many agents you have in the system, you always ending up assigned to the first agent ever created.
When the argument value does not supplied to deleting endpoints, it causes delete a random entry instead since GORM scans the first element from the db that satisfies the filter, which is everything since the filter is empty.
It's requested for clients to be able to set vehicle groups. Right now when a vehicle is created with any groups it's forever.
The preferred way is a PUT
request.
There is no way to delete a group. It would be nice to have one. :)
We need to return system defined vehicle types as an endpoint to the client developer.
We can load swagger.json specfile and override some of it's fields, such as
version
or host
fields dynamically.
Since we have separated vehicle tracking agent specific business layer from
/vehicle/ endpoint set. Now it can be rewritten in a way that query aspect
of the endpoint set will be in the spotlight.
Main features of this endpoint set would be:
Right now this project does not enjoy a full feature authentication mechanism.
This is needed before going into production.
All methods but 'GET' should be private.
The Project started as REST API only. But for the sake of keeping it real-time, we needed a WebSocket endpoint (see #10 ). In order to achieve this cleanly, we need an event subsystem that's easy and robust at the same time.
Currently, our server keeps only the last known position of an agent. It's better to replicate this data in the background to a time series database. Preferablly, to some Prometheus instance.
User can remove himself successfully. It would be nice to return an error when you try to remove yourself as user.
It would be nice to return user credentials ( user's uuid, email etc.) on successful user authentication. Because at this moment there is no way to get uuid of the user who is signed in on the client-side.
We need to return empty json values as null. Right now they are retunred as the fiedl's zero value. e.g. "" for empty string.
Unit tests are needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.