Updated: January 14nd, 2019

Uploading Content

The page explains how an advertiser or device owner may use the Adomni API upload content (e.g. images, videos, etc) into their Adomni account.


For the purposes of this paper we will assume that the user already has an account on Adomni.com, and has access to the credentials for that account.

Content upload overview
Step 1 - Perform login

The customer generates a valid token for their account using the POST /access-tokens endpoint. More detail on the login process can be found here.

Step 2 - Create an upload url

The customer generates makes a request to the POST /content/upload-target endpoint. In order to do so, they will need the name of the file to upload, its content type (e.g., image/jpg, video/mp4, etc), and optionally the name of a content group into which the place should be placed upon upload.

While a content group is not required, it is recommended to keep large quantities of content organized

Step 3 - Upload the content

The API will return a pre-signed url to which the customer will issue a PUT request. Note that the URL expires in one hour, after which it must be generated again. Note that the content type flagged for upload must match the content type specified during link creation. Also note that content is being posted to Amazon's S3 service and not to Adomni, so the Adomni authorization header should NOT be sent during the upload.

Step 4 - Wait a short time for the content to appear in the library

Once posted content is put through a process to prepare it for display. This process runs asynchronously, and so may take several minutes, especially for large videos.

Sample Calls

Programming languages can differ significantly on how they make HTTP requests. The example below uses CURL to show the key headers and fields necessary.

Step 1 - Perform login (replace [USERNAME], [PASSWORD], and [SCOPE])
curl -X POST "https://neon.adomni.com/v1/secure/access-tokens" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"email\":\"[USERNAME]\",\"password\":\"[PASSWORD]\",\"scope\":\"[SCOPE]\"}"
{ "token": "[TOKEN-STRING]", "expires": [EXPIRATION-TIME] }
Step 2 - Create an upload url (replace [TOKEN-STRING], [FILE-NAME], [CONTENT-TYPE], and [CONTENT-GROUP]
curl -X POST "https://neon.adomni.com/v1/content/upload-target" -H "accept: application/json" -H "Authorization: Bearer [TOKEN-STRING]" -H "Content-Type: application/json" -d "{\"fileName\":\"[FILE-NAME]\",\"contentType\":\"[CONTENT-TYPE]\",\"contentGroup\":\"[CONTENT-GROUP]\"}"
{ "id": "[UPLOAD-ID]", "link": "[STEP-3-UPLOAD-LINK]", "expiresEpochMS": [LINK-EXPIRATION-TIME] }
Step 3 - Upload the content (Replase [CONTENT-TYPE], [PATH-TO-FILE], and [STEP-3-UPLOAD-LINK])
curl -X PUT -H "Content-Type: [CONTENT-TYPE]" -T [PATH-TO-FILE] -L "[STEP-3-UPLOAD-LINK]"

No body, just a success status code.