List campaigns
Get the list of campaigns.
Request
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}?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. |
$skip (optional) |
Control paging of campaigns, start results at the given offset, defaults to 0 (1st page of data). |
$top (optional) |
Control paging of campaigns, number of campaigns to return with each call. It returns all campaigns by default. When specifying $top, the response contains a nextLink property describing the path to get the next page if there are more results. |
$filter (optional) |
Filter can be used to restrict the results to campaigns matching a specific state. The syntax is $filter=state eq 'draft'. Valid state values are: draft, scheduled, in-progress, and finished. Only the eq operator and the state property are supported. |
$orderby (optional) |
Sort results by an expression which looks like $orderby=id asc (this example is actually the default behavior). The syntax is $orderby={property} {direction} or just $orderby={property}. The available sorting properties are id, name, state, activatedDate, and finishedDate. The available directions are asc (for ascending order) and desc (for descending order). When not specified the asc direction is used. Only one property at a time can be used for sorting. |
$search (optional) |
Restrict results to campaigns matching the optional $search expression. This currently performs the search based on the name on the campaign only, case insensitive. If the campaign contains the value of the $search parameter anywhere in the name, it matches. For example $search=test would match the following campaign names:
|
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, campaigns are returned as JSON. |
400 |
Invalid parameters or application is disabled. Check response body for details. |
401 |
Authentication error. |
For information about status codes, see Status and Error Codes.
Response Headers
Content-Type |
application/json;charset=utf-8 |
Response Body
A JSON object containing the following properties if the request was successful.
Property |
Description |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
JSON array containing one JSON object per campaign. Each campaign JSON object may contain the following properties:
|
||||||||||||||||||
nextLink |
When using $top parameter and if partial results are returned, this property describes a URI path to get the next results. This property is not set when reaching the last page. |
The following is an example.
{
"value": [
{
"id": 592,
"name": "MyAnnouncement_1",
"state": "draft"
},
{
"id": 591,
"name": "MyAnnouncement_2",
"state": "finished",
"finishedDate": "2012-05-09 13:21Z",
"activatedDate": "2012-05-09 13:21Z"
},
{
"id": 590,
"name": "MyAnnouncement_3",
"state": "scheduled",
"activatedDate": "2012-05-09 13:21Z"
},
{
"id": 589,
"name": "MyAnnouncement_4",
"state": "in-progress",
"activatedDate": "2012-05-09 13:20Z"
}
],
"nextLink": "/subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/campaigns/announcements?api-version=2014-12-01&$top=4&$skip=4"
}
Example
GET /subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/campaigns/announcements?api-version=2014-12-01&$top=4&$orderby=id%20desc HTTP/1.1
Host: management.azure.com
Accept: */*
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSIsImtpZCI6Ik1uQ19WWmNBVGZNNXBPWWlKSE1iYTlnb0VLWSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iL
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
{
"value": [
{
"id": 592,
"name": "MyAnnouncement_1",
"state": "draft"
},
{
"id": 591,
"name": "MyAnnouncement_2",
"state": "finished",
"finishedDate": "2012-05-09 13:21Z",
"activatedDate": "2012-05-09 13:21Z"
},
{
"id": 590,
"name": "MyAnnouncement_3",
"state": "scheduled",
"activatedDate": "2012-05-09 13:21Z"
},
{
"id": 589,
"name": "MyAnnouncement_4",
"state": "in-progress",
"activatedDate": "2012-05-09 13:20Z"
}
],
"nextLink": "/subscriptions/84211edf-7c40-4c47-b152-a6a7233843b7/resourcegroups/MobileEngagement/providers/Microsoft.MobileEngagement/appcollections/myAppCollection/apps/myApp-android/campaigns/announcements?api-version=2014-12-01&$top=4&$orderby=id%20desc&$skip=4"
}