HTTP

The http API is unique among our endpoints in that it does not implement an existing specification. It is a generic endpoint and a convenient method of ingesting data over HTTP.

Endpoint

http

Canonical URL

collect.observeinc.com/v1/http

Legacy Subdomain

http.collect.observeinc.com

How it works

Just send a POST request our way! We will try our best to make sense of it based on the following principles:

  • The request body is parsed according to the content type header.

  • The path component of the URL is encoded as a tag.

  • Query paramaters are encoded as tags.

As an example, the following POST:

$ curl -X POST https://collect.observeinc.com/v1/http/first/example?key=value \
	--user ${OBSERVE_CUSTOMER?}:${OBSERVE_TOKEN?} \
	-H 'Content-Type: application/json' \
	-d '{"message":"Hello World!"}'

Results in an observation with the following values:

Column

Value

OBSERVATION_KIND

http

FIELDS

{"message": "Hello World!"}

EXTRA

{"key": "value", "path": "/first/example"}

The observation fields are based on the request body, while path and query parameters are encoded in EXTRA. All observations in a payload are given the same EXTRA metadata. HTTP headers determine how the content is parsed.

Supported content types

The HTTP endpoint supports the following content type values:

Content-Type

Description

application/json

Parses a single JSON object or array of objects. Each object is a unique observation.

application/x-ndjson

Parses a stream of newline delimited JSON objects. Each object is a unique observation.

application/xml

Internally converts XML object to JSON, and processes it according to application/json handling.

application/msgpack

Parses an array of objects.

text/csv

Generates one observation per CSV record, using the fields defined in the header row. Empty values are omitted.

text/plain

Generates one observation per line.

Note

There are several additional headers that control data parsing. Until these are fully documented, if you need additional options for ingesting your data, please contact support for assistance.

JSON examples

Object

You can submit an object by setting the Content-Type header to application/json. The object will result in a single observation.

{
    "message": "Hello World!"
}
$ curl -X POST https://collect.observeinc.com/v1/http/example \
	--user ${OBSERVE_CUSTOMER?}:${OBSERVE_TOKEN?} --data-binary @payload \
	-H 'Content-Type: application/json'

Array of objects

You can submit an array of objects by setting the Content-Type header to application/json. Each object will result in a separate observation.

[
  {
    "id": 1
  },
  {
    "id": 2
  }
]
$ curl -X POST https://collect.observeinc.com/v1/http/example \
	--user ${OBSERVE_CUSTOMER?}:${OBSERVE_TOKEN?} --data-binary @payload \
	-H 'Content-Type: application/json'

Newline delimited objects

If you have a stream of newline delimited objects, you can submit your data as content type application/x-ndjson. Each object will result in a separate observation.

{
  "id": 1
}
{
  "id": 2
}
{
  "id": 3
}
$ curl -X POST https://collect.observeinc.com/v1/http/example \
	--user ${OBSERVE_CUSTOMER?}:${OBSERVE_TOKEN?} --data-binary @payload \
	-H 'Content-Type: application/x-ndjson'