Publish Events to Novo Cloud
Use the Publish Events API to publish events to the Novo Cloud. The Request and Response structure is described below with some sample requests.
Use the Bulk Publish Events API described below for sending a batch of events.
Publish APIs
JSON Specification
Request structure has an envelope with the actual payload in the embedded data attribute.
| Name |
Required |
Details/Notes |
| id |
Yes |
ID of the event, must be unique within the domain and source. Could be a string of UUID, a number or a combination of both |
| source |
Yes |
Identifies the source context of an event. Could be a device id, an instance id or the host of a service |
| ordering_key |
No |
Identifies how the events are grouped. Could be a user id etc. |
| sequence_number |
No |
If non-empty, identifies sequence of related messages for which publish order should be respected. Sequence number to identify order of events. Can be any incremental number generated at source. |
| event_type |
Yes |
Describes the type of event with respect to the occurrence origin. Could be data update event, engine start/stop event, service job finish event etc. The origin would typically be a system or device such as a vehicle, data publishing server, etc. |
| domain |
Yes |
Describes the domains of event with respect to the occurrence origin. The value for this field must be obtained from Novo for a given event / context and included when publishing events. |
| data_content_type |
Yes |
Content type of the data value. Must adhere to RFC 2046 format. https://tools.ietf.org/html/rfc2046. Only supports application/json in this version |
| subject |
No |
Description of the event. Describe the subject of this event |
| time |
Yes |
Datetime of when the event occurred. Must adhere to RFC 3339. Date format should be 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'. |
| data |
Yes |
The event data field. e.g. {"id":"P-H0-840jx7ps","name":"Novo","address":"4655 Great America Pkwy"} |
Status Codes
HTTP Status Codes
| Code |
Description |
| 200 |
OK |
| 401 |
Unauthorized |
| 400 |
Bad Request |
| 500 |
internal server error |
Application Status Codes
| Code |
Status Message |
Detailed Description |
| 25200 |
SUCCESS |
Processing Succeded |
| 25201 |
MESSAGE_ORDERING_PENDING |
0 items inserted, waiting for preceeding message |
| 25206 |
PARTIAL_SUCCESS |
Partial success processing bulk event |
| 25400 |
FAILED |
Processing Failed |
| 25401 |
INVALID_DOMAIN |
Invalid Domain |
| 25402 |
SCHEMA_VALIDATION_FAILED |
Schema Validation Failed |
| 25403 |
MESSAGE_SIZE_EXCEEDED |
Size of message beyond acceptable limit |
| 25404 |
REQUIRED_PARAMETER_MISSING |
Required Parameter Missing |
| 25405 |
INVALID_CONTENT_TYPE |
Invalid Content Type |
| 25406 |
INVALID_EVENT_TYPE |
Event Type Not Supported |
| 25501 |
INTERNAL_SYSTEM_ERROR |
Internal System Error |
1. Single Event
Request
- URI
eventhub/v1/events
- Method POST
- Headers
| Content-Type: application/json
x-tn-api_key: %API_KEY%
x-tn-api_signature: %API_SIGNATURE%
|
- Body
| {
"id": "565217e3-b503-4bd8-a1a7-8c507aa49c81",
"source": "Sample_Data_Feed_Service_1",
"ordering_key": "sample_service_group_1",
"spec_version": "1.0",
"event_type": "SampleDataUpdate",
"domain": "Sample_Data_Feed",
"data_content_type": "application/json",
"time": "2020-12-08T07:08:46.940+0000",
"data": "{\"id\":\"USRIVIL0001\",\"type\":\"UNKNOWN\",\"name\":\"Rivian Charging Station - 0001\",\"address\":\"850 Hansen Way\",\"city\":\"Palo Alto\",\"postal_code\":\"94304\",\"country\":\"USA\",\"coordinates\":{\"latitude\":\"37.418620\",\"longitude\":\"-122.140650\",\"name\":null},\"related_locations\":null,\"suboperator\":null,\"owner\":null,\"facilities\":[\"RECREATION_AREA\",\"WIFI\",\"RESTAURANT\"],\"time_zone\":\"America\/Los Angeles\",\"opening_times\":{\"twentyfourseven\":false,\"exceptional_openings\":null,\"exceptional_closings\":null},\"charging_when_closed\":false}"
}
|
Response
| {
"status": {
"status": "25200",
"message": "1 Item inserted for Sample_Data_Feed"
}
}
|
Sample Request
| curl -X POST "https://api.stage.novo.us/eventhub/v1/events" -H 'Content-Type: application/json' -H 'x-tn-api_key: API_KEY' -H 'x-tn-api_signature:API_SIGNATURE'
|
| {
"id": "565217e3-b503-4bd8-a1a7-8c507aa49c81",
"source": "Sample_Data_Feed_Service_1",
"ordering_key": "sample_service_group_1",
"spec_version": "1.0",
"event_type": "SampleDataUpdate",
"domain": "Sample_Data_Feed",
"data_content_type": "application/json",
"time": "2020-12-08T07:08:46.940+0000",
"data": "{\"id\":\"P-H0-840jx7ps\",\"name\":\"Novo\",\"address\":\"4655 Great America Pkwy\"}"
}
|
| {
"status": {
"status": "25200",
"message": "1 Item inserted for Sample_Data_Feed"
}
}
|
2. Bulk Publish Events (Coming soon)
Use the Bulk Publish Events API to enable multiple events to be sent as part of one request (in bulk).
Bulk Publish API Request
- URI
eventhub/v1/events
- Method POST
- Headers
| Content-Type: application/json
x-tn-api_key: %API_KEY%
x-tn-api_signature: %API_SIGNATURE%
|
- Body
Sample Request
| curl -X POST "https://api.stage.novo.us/eventhub/v1/events/bulk" -H 'Content-Type: application/json' -H 'x-tn-api_key: API_KEY' -H 'x-tn-api_signature:API_SIGNATURE'
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 | [ {
"id": "565217e3-b503-4bd8-a1a7-8c507aa49c81",
"source": "Sample_Data_Feed_Service_1",
"ordering_key": "sample_service_group_1",
"spec_version": "1.0",
"event_type": "SampleDataUpdate",
"domain": "Sample_Data_Feed",
"data_content_type": "application/json",
"time": "2020-12-08T07:08:46.940+0000",
"data": "{\"id\":\"P-H0-840jx7ps\",\"name\":\"Novo\",\"address\":\"4655 Great America Pkwy\"}"
},
{
"id": "565217e3-b503-4bd8-a1a7-8c507aa49c81",
"source": "Sample_Data_Feed_Service_2",
"ordering_key": "sample_service_group_1",
"spec_version": "1.0",
"event_type": "SampleDataUpdate",
"domain": "Sample_Data_Feed",
"data_content_type": "application/json",
"time": "2020-12-08T07:08:46.940+0000",
"data": "{\"id\":\"P-H0-840jx7ps\",\"name\":\"Novo\",\"address\":\"4655 Great America Pkwy, Santa Clara, CA, 95054\"}"
}
]
|
Response
| {
"status": {
"status": "25200",
"message": "2 Items inserted for Sample_Data_Feed"
}
}
|