Test (saved campaign)

 

Test an existing campaign (created with Create campaign) on a set of devices.

You cannot use this command to perform one to one delivery; push statistics won’t be available, please use the Push campaign command instead.

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}/{id}/test?api-version=2014-12-01

HTTP/1.1

Parameter

Description

kind

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

id

Campaign identifier as returned by a call to Create campaign. You can get a list of campaigns by calling List campaigns.

Parameter

Description

api-version

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

The following table describes required and optional request headers.

Request Header

Description

Authorization

See Authentication.

Content-Type

application/json

A JSON object with the following properties:

Property

Description

deviceId

Device identifier (as returned by the SDK).

lang

Optional. The language to test expressed using ISO 639-1 code. The default language of the campaign will be used if the parameter is not provided.

A 200 status code is returned when the command is accepted.

Code

Description

200

Test campaign queued successfully.

400

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

401

Authentication error.

404

Campaign not found.

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

Content-Type

application/json

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

Property

Description

id

Campaign identifier.

state

New campaign state : queued. The test push is being processed and should be received soon on devices.

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

{
  "deviceId": "d6ac5ed96f658b09199205b79c75770c",
  "lang": "en"
}

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "state": "queued"
}
Show: