Updated: January 14nd, 2019
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.
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.
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
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.
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.
Programming languages can differ significantly on how they make HTTP requests. The example below uses CURL to show the key headers and fields necessary.
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] }
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] }
curl -X PUT -H "Content-Type: [CONTENT-TYPE]" -T [PATH-TO-FILE] -L "[STEP-3-UPLOAD-LINK]"
No body, just a success status code.