Share via


Get campaign

 

The Get campaign operation retrieves information about a previously created campaign.

Request

Get campaign by id or by name.

Method

Request URI

HTTP version

GET

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

HTTP/1.1

GET

https://management.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/Microsoft.MobileEngagement/appcollections/{app-collection}/apps/{app-resource-name}/campaignsByName/{kind}/{name}?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.

id

Campaign identifier (use only with the /campaigns/{kind}/{id} URI). The id value is returned by a call to Create campaign. You can get a list of campaigns by calling List campaigns.

name

Campaign name (use only with the /campaignsByName/{kind}/{name} URI). The name value is set when the campaign is created. You can get a list of campaigns by calling List campaigns.

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.

Accept (optional)

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

Request Body

None.

Response

Response Status Codes

Code

Description

200

Success, campaign is returned as JSON.

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.

Response Headers

Content-Type

application/json

Response Body

JSON representation of the campaign using the correct format. See Campaign format for further details. In addition to the campaign format, the following properties are also present:

Property

Description

state

The current state of the campaign (draft, scheduled, in-progress, or finished).

activatedDate

The date at which the campaign was activated (Not present if not yet activated). The date conforms to the following format: yyyy-MM-dd HH:mm'Z' as specified by the ISO 8601 standard.

finishedDate

The date at which the campaign was finished (Not present if not yet finished). The date conforms to the following format: yyyy-MM-dd HH:mm'Z' as specified by the ISO 8601 standard.

The following is an example.

{
  "id": 1,
  "name": "MyAnnouncement",
  "state": "finished",
  "type": "text/plain",
  "audience": {"expression" : "not German", "criteria": {"German": { "type": "language", "name": "de"} } },
  "deliveryTime": "activity",
  "deliveryActivities": ["Main", "Settings"],
  "startTime": "2011-10-23 17:34Z",
  "endTime": "2011-10-25 17:34Z",
  "activatedDate": "2011-10-23 17:00Z",
  "finishedDate": "2011-10-25 17:34Z",
  "notificationType": "system",
  "notificationTickerIcon": true,
  "notificationIcon": true,
  "notificationCloseable": true,
  "notificationSound": false,
  "notificationVibrate": false,
  "title": "Foo app is now available",
  "body": "This is a great app, that allows you to bla bla..."
  "notificationTitle": "New application available right now!",
  "notificationMessage": "Click here to download this great app.",
  "actionButtonText": "Download now",
  "exitButtonText": "Later",
  "actionUrl": "http://store.download.com/?id=123&lang=en",

  "localization": {
    "fr": {
      "title": "L'application foo est maintenant disponible",
      "body": "Voici une application géniale qui vous permet de bla bla..."
      "notificationTitle": "Nouvelle application disponible dès maintenant!",
      "notificationMessage": "Cliquez ici pour télécharger cette application.",
      "actionButtonText": "Télécharger maintenant",
      "exitButtonText": "Plus tard",
      "actionUrl": "http://store.download.com/?id=123&lang=fr",
    }
  }
}

Examples

Example using campaign identifier.

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

HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8

{
  "id": 1,
  "name": "MyAnnouncement",
  "state": "finished",
  "type": "text/plain",
  "audience": {"expression" : "not German", "criteria": {"German": { "type": "language", "name": "de"} } },
  "deliveryTime": "activity",
  "deliveryActivities": ["Main", "Settings"],
  "startTime": "2011-10-23 17:34Z",
  "endTime": "2011-10-25 17:34Z",
  "activatedDate": "2011-10-23 17:00Z",
  "finishedDate": "2011-10-25 17:34Z",
  "notificationType": "system",
  "notificationTickerIcon": true,
  "notificationIcon": true,
  "notificationCloseable": true,
  "notificationSound": false,
  "notificationVibrate": false,
  "title": "Foo app is now available",
  "body": "This is a great app, that allows you to bla bla..."
  "notificationTitle": "New application available right now!",
  "notificationMessage": "Click here to download this great app.",
  "actionButtonText": "Download now",
  "exitButtonText": "Later",
  "actionUrl": "http://store.download.com/?id=123&lang=en",

  "localization": {
    "fr": {
      "title": "L'application foo est maintenant disponible",
      "body": "Voici une application géniale qui vous permet de bla bla..."
      "notificationTitle": "Nouvelle application disponible dès maintenant!",
      "notificationMessage": "Cliquez ici pour télécharger cette application.",
      "actionButtonText": "Télécharger maintenant",
      "exitButtonText": "Plus tard",
      "actionUrl": "http://store.download.com/?id=123&lang=fr",
    }
  }
}

Example using campaign name.

GET /subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/campaignsByName/announcements/MyAnnouncement?api-version=2014-12-01 HTTP/1.1
Host: management.azure.com
Accept: */*
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iL

HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8

{
  "id": 1,
  "name": "MyAnnouncement",
  "state": "finished",
  "type": "text/plain",
  "audience": {"expression" : "not German", "criteria": {"German": { "type": "language", "name": "de"} } },
  "deliveryTime": "activity",
  "deliveryActivities": ["Main", "Settings"],
  "startTime": "2011-10-23 17:34Z",
  "endTime": "2011-10-25 17:34Z",
  "activatedDate": "2011-10-23 17:00Z",
  "finishedDate": "2011-10-25 17:34Z",
  "notificationType": "system",
  "notificationTickerIcon": true,
  "notificationIcon": true,
  "notificationCloseable": true,
  "notificationSound": false,
  "notificationVibrate": false,
  "title": "Foo app is now available",
  "body": "This is a great app, that allows you to bla bla..."
  "notificationTitle": "New application available right now!",
  "notificationMessage": "Click here to download this great app.",
  "actionButtonText": "Download now",
  "exitButtonText": "Later",
  "actionUrl": "http://store.download.com/?id=123&lang=en",

  "localization": {
    "fr": {
      "title": "L'application foo est maintenant disponible",
      "body": "Voici une application géniale qui vous permet de bla bla..."
      "notificationTitle": "Nouvelle application disponible dès maintenant!",
      "notificationMessage": "Cliquez ici pour télécharger cette application.",
      "actionButtonText": "Télécharger maintenant",
      "exitButtonText": "Plus tard",
      "actionUrl": "http://store.download.com/?id=123&lang=fr",
    }
  }
}