RESTful API endpoints for collection service

Abstract

Describes the RESTful API endpoints available for the Universal Tracker collection service.

This topic describes the RESTful API endpoints you can use to access the collection service.

Authentication

All collection service endpoints are public and require no authentication or authorization.

You use this endpoint to add a new interaction to the collection service. Each request must contain a Content-Type header with the value application/json.

Verb

PUT

URL

/interaction

The request body must contain a JSON object. The JSON object can have a number of properties.

A successful operation returns the status code 201 (Created). The message body contains the created interaction ID.

Errors give one of these responses:

Response

Description

400

Bad Request. This indicates that the server does not accept the request, maybe because a parameter is invalid. It also indicates that you should not repeat the request. The body of the error text contains the error message text.

500

Internal Server Error. The body of the error text can be empty or contain an array of error messages: [Msg1, Msg2].

Here is an example of an interaction request:

PUT https://ut/interaction
Content-Type: application/json
{
    "ChannelId":"27b4e611-a73d-4a95-b20a-811d295bdf77",
        "Initiator":"contact",
        "Contact":{
            "Source":"demosrc",
            "Identifier":"demoident"
    },
    "UserAgent":"Mozilla/5.0(NintendoSwitch;ShareApplet)AppleWebKit/601.6(KHTML,likeGecko)NF/4.0.0.5.9NintendoBrowser/5.1.0.13341.",
    "Events":[
        {
            "type":"event",
            "Timestamp":"2019-01-02T11:11:11.528",
            "DefinitionId":"2DB21B3F-DA14-4AAB-AA6C-C6FCF45FFBF5",
            "EventUniqueId":"ff45c5a2-fb30-4985-99b7-88c725ab3df1"
        }
    ]
}

You use this endpoint to add a new event to the collection service. Each request must contain a Content-Type header with the value application/json.

Verb

PUT

URL

/event

There are a number of events that you can include in the event request body.

A successful operation returns the status code 201 (Created) with an empty message body.

Errors give one of these responses:

Response

Description

400

Bad Request. This indicates that the server does not accept the request, maybe because a parameter is invalid. It also indicates that you should not repeat the request. The body of the error text contains an array of error messages: [Msg1, Msg2].

500

Internal Server Error. The body of the error text contains an array of error messages: [Msg1, Msg2].

Here is an example of an event request:

PUT https://ut/event
Content-Type: application/json
[
    {
        "type":"event",
        "TrackingInteractionId":"d641b469-56a6-4db0-bac1-12979e7f370d",
        "Timestamp":"2018-10-25T14:12:01.766Z",
        "Duration":"0.0:00:45.123",
        "DefinitionId":"B826EFFC-D90A-4504-8430-1884F01F7BDF"
    },
    }
        "type":"pageview",
        "TrackingInteractionId":"d641b469-56a6-4db0-bac1-12979e7f370d",
        "Timestamp":"2018-10-26T14:13:01.766Z",
        "Duration":"0.0:00:11.124",
        "EventDefinitionId":"9326CB1E-CEC8-48F2-9A3E-91C7DBB2166C",
        "ItemLanguage":"by",
        "ItemVersion":2,
        "ItemId":"EFB92FA2-29A0-4A21-8DB7-5C9251C05AAF",
        "Url":"/",
        "SitecoreRenderingDevice":{"Id":"fe5d7fdf-89c0-4d99-9aa3-b5fbd009c9f3","Name":"Default"}
    },
    {
        "type":"campaign",
        "TrackingInteractionId":"d641b469-56a6-4db0-bac1-12979e7f370d",
        "Timestamp":"2018-10-26T14:14:48.766Z",
        "EventUniqueId":"ff45c5a2-fb30-4985-99b7-88c725ab3df5",
        "Duration":"0.0:00:10.124",
        "EventDefinitionId":"F358D040-256F-4FC6-B2A1-739ACA2B2983",
        "CampaignDefinitionId":"110d559f-dea5-42ea-9c1c-8a5df7e70ef9"
    },
    {
        "type":"download",
        "TrackingInteractionId":"d641b469-56a6-4db0-bac1-12979e7f370d",
        "Timestamp":"2018-10-25T08:39:48.766Z",
        "Duration":"0.0:00:10.124",
        "EventDefinitionId":"FA72E131-3CFD-481C-8E15-04496E9586DC"
    }
]

You use this endpoint to complete an interaction.

Verb

POST

URL

/interaction/complete

The request body must contain the ID for the interaction that you want to complete.

A successful operation returns the status code 202 (Accepted) with the message content true.

Errors give this response:

Response

Description

400

Bad Request. This indicates that the server does not accept the request, maybe because a parameter is invalid. It also indicates that you should not repeat the request. The body of the error text contains either an error text or an array of error messages: [Msg1, Msg2].

Here is an example of a complete request:

POST https://ut/interaction/complete
"6914c965-9c27-4777-9110-12c224e2e810"