Share via


Create campaign

 

Create a Reach campaign (announcement, poll, data push or native push).

Request

Method

Request URI

HTTP version

POST

https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/Microsoft.MobileEngagement/appcollections/{app-collection}/apps/{app-resource-name}/campaigns/{kind}?api-version=2014-12-01

HTTP/1.1

Authentication

See Authentication.

Request URI Path Parameters

Parameter

Description

kind

Kind of campaign. Valid values are: announcements, polls, dataPushes, and nativePushes.

Query String Parameters

Parameter

Description

api-version

API version, the only supported value is 2014-12-01.

Request Headers

The following table describes required and optional request headers.

Request Header

Description

Authorization

See Authentication.

Content-Type

application/json

Accept (optional)

Its recommended to pass */* or application/json to have JSON error responses.

Request Body

JSON representation of the campaign. See Campaign format for further details.

Response

A 201 status code is returned when the campaign is created.

The Location header gives you the URI to get the resource. The last segment is the campaign identifier.

Response Status Codes

Code

Description

201

Created.

400

Invalid parameters or application is disabled. Check response body for details.

401

Authentication error.

409

Another campaign with the same name already exists.

For information about status codes, see Status and Error Codes.

Response Headers

Location

URI of the new resource. The last segment of the URI is the campaign identifier.

Response Body

A JSON object containing the following properties if the request was successful.

Property

Description

id

New campaign identifier.

state

Campaign state after creation. This will always be draft.

Example

POST /subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/campaigns/announcement?api-version=2014-12-01 HTTP/1.1
Host: management.azure.com
Accept: */*
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iL

{
  "name": "MyCampaign",
  "type": "only_notif",
  "deliveryTime": "any",
  "notificationType": "system",
  "notificationTitle": "Welcome!",
  "notificationMessage": "To this great app!"
}

HTTP/1.1 201 Created
Location: /84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/campaigns/announcements/1
Content-Type: application/json

{
  "id": 1,
  "state": "draft"
}