Skip to content

Creating an endpoint

Endpoints are very useful to organise and retrieve receipts over time and batches.

INFO

If you missed it, see what we mean by endpoints here.

Creating an endpoint

Creating an endpoint is pretty simple. If you already have tried to create a campaign via the API, this step-by-step tutorial will look very similar.

1. Creating the endpoint

shell
POST https://api.omen-data.io/v2/endpoints
Authorization: Bearer {your_access_token}

{
    "name" : "myEndpoint",
    "outgoingUrl" : "http://mydomain.com/myresponsehandler",
    "dominantLanguage" : "fr-FR"
}
POST https://api.omen-data.io/v2/endpoints
Authorization: Bearer {your_access_token}

{
    "name" : "myEndpoint",
    "outgoingUrl" : "http://mydomain.com/myresponsehandler",
    "dominantLanguage" : "fr-FR"
}

You will then have a response like this :

json
{
    "uid" : "e67c9571-47a7-42cd-8439-c94bc9d5e478",
    "createdAt" : "2019-12-19T14:49:19.130+00:00",
    "updatedAt" : "2020-04-21T09:09:28.137+00:00",
    "dominantLanguage" : "fr-FR",
    "outgoingUrl" : "http://mydomain.com/myresponsehandler",
    "name" : "myEndpoint",
    "companyUid" : "my-company-uid"
}
{
    "uid" : "e67c9571-47a7-42cd-8439-c94bc9d5e478",
    "createdAt" : "2019-12-19T14:49:19.130+00:00",
    "updatedAt" : "2020-04-21T09:09:28.137+00:00",
    "dominantLanguage" : "fr-FR",
    "outgoingUrl" : "http://mydomain.com/myresponsehandler",
    "name" : "myEndpoint",
    "companyUid" : "my-company-uid"
}

You can get more infos on how to use our API here.

2. Sending a receipt to an endpoint

Now that you have the endpoint uid that you gathered from the previous request, you can send a receipt to this very endpoint in order to launch the analysis.

shell
POST https://api.omen-data.io/v2/endpoints/{endpoint_uid}/documents?name={document_identifier}
Authorization: Bearer {your_access_token}

{path_to_your_file.jpg}
POST https://api.omen-data.io/v2/endpoints/{endpoint_uid}/documents?name={document_identifier}
Authorization: Bearer {your_access_token}

{path_to_your_file.jpg}

The document_identifier field is a way for you to retrieve this specific document later.

And you will get in response something similar to this:

shell
HTTP/1.1 200 OK
{
    [...]
    "name": "document_identifier",
    "endpointUid": "endpoint_UID",
    "status" : "PROCESSING", //Means that your receipt is currently being processed
    [...]
}
HTTP/1.1 200 OK
{
    [...]
    "name": "document_identifier",
    "endpointUid": "endpoint_UID",
    "status" : "PROCESSING", //Means that your receipt is currently being processed
    [...]
}

For more information on all the possibilities of the API, check our documentation here.