Parsers¶
Parser Data Structure¶
A parser is a component that converts a packet payload into one or more readings.
Please check our parser section for more information about how parsers work.
In responses, a parser looks like this:
{
"updated_at": "2017-07-31T12:19:28.278864Z",
"name": "Test Parser",
"mandate_id": "50e032fb-964f-440d-9b9a-47870667373c",
"language": "ex",
"inserted_at": "2017-07-27T07:27:37.799170Z",
"id": "e49823a7-4717-4670-b4e9-c22d8b50b751",
"code": "defmodule Parser do\n use Platform.Parsing.Behaviour\n\n def parse(event, _meta) do\n %{result: 1}\n end\nend"
}
Key | Example | Description |
---|---|---|
id | 3e097a97-e504-4b4b-8182-ae148f2109f3 | Unique parser ID (UUID4) |
code | defmodule … | Parser code as a string in the language expressed by language |
language | ex | Programming language used in the parser code. Supported: ex for Elixir code. |
inserted_at | 2017-07-31T12:15:18.289981Z | Date of the creation to the parser |
updated_at | 2017-07-31T12:15:18.289981Z | Date of the last edit of the parser |
mandate_id | cee40cb2-f58c-4ca8-ae91-4ae76cba5119 | Reference to a mandate to which this parser belongs |
name | Test Parser | Name of the parser |
List all Parsers¶
Method: GET
, Endpoint: /parsers
Example Request¶
GET https://element-iot.com/api/v1/parsers?auth=46cb688e2c0b468e26e914235d4b73ea
Example Response¶
{
"status": 200,
"retrieve_after_id": "a70a234e-d186-4ca8-836b-74816738939e",
"ok": true,
"body": [
// Contains an array of parsers
]
}
This endpoint returns a paginated list of parsers.
If you want to configure the sort order or restrict the results to a specific time interval, please refer to the Pagination section of this documentation.
Show a single Parser¶
Method: GET
, Endpoint: /parsers/:parser_id
Example Request¶
GET https://element-iot.com/api/v1/parsers/adedada4-c93d-425c-a98d-ba79d930fa9c?auth=46cb688e2c0b468e26e914235d4b73ea
Example Response¶
{
"status": 200,
"ok": true,
"body": {
// Contains the parser
}
}
The parser ID must be the id
of the parser.