Media Upload API Version 1

Version 1 of the Media Upload API allows you to upload a media file to OpenMarket's Content Management System (CMS). Media files you upload can then be sent along with your RCS messages.

Before uploading any media, you must have a valid account and permission to upload your media files. If you are uploading an image, the image must be encoded to Base64 and the request submitted using JSON with basic authentication.

Important: An uploaded encrypted file remains in the CMS until its automatically deleted after 30 days. If you want to manage your media file, such as delete it or extend the expiration date, we recommend using version 2 of the Media Upload API.

Quick facts

Method

POST

Returns

Success and failure responses

Available

All regions

Prerequisites

You must have the appropriate IDS Account ID

Request URL Definition

Production

POST https://rcs.openmarket.com/cms/v1/content

Pre-production

POST https://rcs.openmarket.com/cms/v1/content

Authentication

Parameter

Description

Basic Authorization Header

Username and password of the account to determine access and authorization.

Type: Authorization header

Required: Yes.

Content-Type

 

Indicates the media type.

Type: Content-Type: application/json

Required: Yes

Header example

Authorization:  Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type:application/json

Upload request

An upload request is composed of the following:

Parameter

Description

mimeType

 

Identifies the media type. All mime types are accepted for upload — for example, image/jpeg. Please note that some phones might not accept an uncommon type, which occurs on a phone-by-phone basis.

Type: string

Required: Yes. Must be one of the following MIME types:

  • audio/mpeg

  • application/pdf

  • image/gif

  • image/jpeg

  • image/png

  • video/mpeg

  • video/mp4

  • video/quicktime

idsAccout

IDS account ID used to authenticate the upload to the CMS.

Type: string

Required: Yes.

fileSize

Used to validate that the content is not corrupted if the size passed here is different than the size of the file. If the file sizes do not match, an error response is returned. See Response codes below.

Type: integer

Required: Yes. The maximum size can be no larger than 100 MB.

content

Base64-encoded file identifying the media to upload.

Type: string

Required: Yes. The maximum size can be no larger than 100 MB.

Example JSON request

{
  "mimeType" : "image/png",
  "idsAccountId" : "000-000-115-00842",
  "fileSize" : 18679,
  "content" : "iVBORw0KGgoAAAANSUhEUgAAAuQAAADnCAMAAABhcbPQAAAABGdBTUEAALGP..."
}

Response header

The following header is returned as a response:

X-Request-Id: 053-8a767024-1243-4809-836e-b83896a37b6a
Location: https://s3-us-west-1.amazonaws.com/openmarket-us-west-1-rcs-cms-uploads-test/f6ee3cb/d192591a-3aaa-4f40-8a55-1653fa3a9c44

It is composed of the following:

Parameter

Description

X-Request-Id

The generated request identifier.

Type: string

Location

 

The URL of the uploaded media file.

Type: string

Response codes

Response code

Message

Description

201

Content created.

The response also contains Location: <File URL> in the header.

The media file was successfully uploaded. The URL of the file upload is also returned.

400

 

Failed validation.

{
    "invalidReasons": [
        "Missing IDS account ID",
        "Supplied file size does not match content"
    ],
    "valid": false
}
The file failed to upload. The reason for the failure is returned in the message.
401

Unauthorized

You do not have the authorization to upload the file.
500 Unexpected error The file failed to upload, but the specific reason could not be determined.