REST API

Overview

For server-side logging and use in non-web contexts (such as native mobile apps), send events to SeaUrchin.IO using the REST API.

POST /v1/capture

MethodPOST
URLhttps://log.seaurchin.io/rest/v1/capture
BodyJSON array of event objects. See the "Event Objects" section below for more details.

Event Objects

Common fields

The following fields are required for every event.

keyvaluedescription
uuser or device idstring
oevent orderingnumber -- increase with each subsequent event
ttimestampmilliseconds since the epoch

Search event

keyvaluedescription
fflow idnumber
e"s"event type
susearch urlstring
sqsearch querystring
sosearch offset / pagenumber -- later pages should have higher numbers
sfsearch facetsJSON object containing facet: [values] mappings
sdsearch durationnumber in milliseconds

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "s",
        "su": "/search",
        "sq": "beach towels",
        "sf": {"rating": ["5 stars"]},
        "sd": 250
    },
    {
        ...
    }
]

Result display event

keyvaluedescription
fflow idnumber
e"d"event type
diresult container idgenerated uuid string
dtresult container top offsetnumber -- used to calculate result ordering (items higher up should have smaller values than those below)
dlresult container left offsetnumber -- used to calculate result ordering (items on the left should have smaller values than those on the right)
dcresult titlestring
duresult urlstring
dpresult pricestring (null if not applicable)

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "d",
        "di": "item-a",
        "dt": 1,
        "dl": 1,
        "dc": "Item A",
        "du": "/item/a",
        "dp": "$19.99"
    },
    {
        "u": "abcd-1234-abcd-1234",
        "o": 2,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "d",
        "di": "item-b",
        "dt": 2,
        "dl": 1,
        "dc": "Item B",
        "du": "/item/b",
        "dp": null
    },
    {
        ...
    }
]

Result click event

keyvaluedescription
fflow idnumber
e"c"event type
ciresult container idgenerated uuid string -- should match id of the corresponding display event
ccresult titlestring
curesult urlstring

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "c",
        "ci": "item-a",
        "cc": "Item A"
        "cu": "/item/a"
    },
    {
        ...
    }
]

Item page view event

keyvaluedescription
fflow idnumber
e"i"event type
iuitem page urlstring
itdwell time on page in millisecondsnumber

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "i",
        "iu": "/item/a"
        "it": 60000
    },
    {
        ...
    }
]

Goal -- set items event

keyvaluedescription
fflow idnumber
e"f"event type
figoal idnumber
faarray of associated item objectsitem object -- { name: <name (string)>, url: <url (string)>, quantity: <quantity (string)>, price: <unit price (string)> }
fsorder subtotalstring

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "f",
        "fi": 9876543210
        "fa": [{
            name: "Item A",
            url: "/item/a",
            quantity: 2,
            price: "$1.50"
        }],
        "fs": "$3.00"
    },
    {
        ...
    }
]

Goal -- conversion event

keyvaluedescription
fflow idnumber
e"g"event type
gigoal idnumber -- should match id of the corresponding goal set items event

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "g",
        "gi": 9876543210
    },
    {
        ...
    }
]

Tag event

keyvaluedescription
fflow idnumber
e"t"event type
tktag keystring
tvtag valuestring

Example

[
    {
        "u": "abcd-1234-abcd-1234",
        "o": 1,
        "t": 1441065600000,
        "f": 1234567890,
        "e": "t",
        "tk": "custom key",
        "tv": "custom value"
    },
    {
        ...
    }
]
Can't find what you're looking for? Send an email to support@seaurchin.io