Create a Subscription

This operation enables you to create a subscription. This returns with the details of the new subscription, including the subscription ID. You will need this ID for other operations.

The type of subscription created is a simple mailing list, with no automated MEP service. To create a subscription that uses a MEP service, you must use the MEP user interface rather than this operation.

Quick facts

Method

GET

Returns

  • Accepted response: XML
  • Rejected response: plain text

Available

All regions

Prerequisites

You must have MEP provisioned with OpenMarket, and the following roles set in the user account:

  • Main Roles: Subscription Manager/User
  • Other Roles: View and download user details, HTTP Subscription API user

More information

See MEP Operations and Making Subscription Requests.

Try It Out

If you'd like to try out this call using cURL, see Making Subscription Requests, which will take you through tasks such as creating and disabling subscriptions, and adding or removing end users.

Making a Request

Definition

GET https://cmx2api.openmarket.com/subscriptionapi/createsubscription

URL example

https://cmx2api.openmarket.com/subscriptionapi/createsubscription?username=MyUsername&password=P4S5W0Rd&collection=F9E8D7C6B5A4&name=Software+Update&description=Customers+who+requested+software+update+notifications

Query parameters

Parameters must be URL encoded.

Parameter

Description

username

The username used to access MEP.

Required: yes

Type: string

password

The password associated with the MEP username.

Required: yes

Type: string

collection

 

The ID of the collection that the new subscription belongs to. This must already exist in MEP. To retrieve a collection ID, use the Get Subscription Collections operation.

Required: yes

Type: string

description

 

The description that you would like to give the subscription. This can be up to 255 characters in length.

Required: no

Type: string

Header fields

There is no data required in the header.

Response from OpenMarket

Accepted requests

OpenMarket responds to a successful request with a status code of 200 and the details you have just added in the response body.

HTTP/1.1 200 OK
Date: Tue, 15 Mar 2016 16:14:43 GMT
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Content-Type: text/plain

<?xml version="1.0" encoding="ISO-8859-1"?>
<subscriptions>
   <subscription>
      <id>1A2B3C4D5E</id>
      <name>SoftwareUpdate</name>
      <description>Customers who requested software update notifications</description>
      <collection>F9E8D7C6B5A4</collection>
      <enabled>true</enabled>
   </subscription>
</subscriptions>

Response body

The XML response body will include following data.

Element

Description

subscriptions

Root element. Contains the element: subscription.

Returned: Always

subscription

Element containing information about the subscription.

Returned: Always

id

A unique alphanumeric ID that OpenMarket has given the subscription.

These are referred to as listIds in broadcast operations.

Type: string

Returned: Always

name

The name that you gave the subscription.

Type: string

Returned: Always

description

The description that you gave the subscription.

Type: string

Returned: Always

collection

The ID of the collection that the subscription belongs to.

Type: string

Returned: Always

enabled

Whether the subscription is enabled or disabled. Newly created subscriptions are enabled (true).

For information about disabled subscriptions, see Creating, Disabling, and Re-enabling Subscriptions.

Type: Boolean

Returned: Always

Rejected requests

If your request is rejected then the body of the response will contain a plain text description of the error. For example:

HTTP/1.1 400 Bad Request
Date: Tue, 15 Mar 2016 11:48:56 GMT
Server: Apache-Coyote/1.1
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain
			
Your request is invalid, specifically the following parameter is incorrect: collection=ABCDE

See Response error messages below for a list of the possible error messages.

Testing your integration

As subscription operations do not send messages, the best way to test your integration is directly with MEP. We recommend that you test regularly as you build your campaigns and services in MEP, so that you can troubleshoot any issues faster.

For more information on using each operation, see Making Subscription Requests.

Troubleshooting

Response error messages

These error messages are returned in the response body when there was a problem with receiving the request.

Message

Description

Your request is invalid, specifically the following parameter is incorrect: <parameter>=<value>

You request contains a problem with the specified mandatory parameter that has stopped MEP from being able to process the request. If the <value> is “null”, then the parameter name is misspelled or the parameter is missing. Otherwise, the value you specified is invalid or does not match the available options. Correct the error and resend the message.

Your username and/or password is incorrect. Check and try again.

Either the username or the password parameter has not been correctly specified. Both parameters are mandatory. Check that both parameters are specified, and that you have entered the correct values for each parameter.

You do not have the necessary roles or permissions to perform the action: <description>

Your access rights in MEP do not allow you use the operation. The information in the <description> part of the response will tell you the role or permission that you are missing.