{ "swagger": "2.0", "info": { "title": "ApiManagementClient", "description": "Use these REST APIs for performing operations on Subscription entity associated with your Azure API Management deployment. The Subscription entity represents the association between a user and a product in API Management. Products contain one or more APIs, and once a product is published, developers can subscribe to the product and begin to use the product’s APIs.", "version": "2016-10-10" }, "host": "management.azure.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security": [ { "azure_auth": [ "user_impersonation" ] } ], "securityDefinitions": { "azure_auth": { "type": "oauth2", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "flow": "implicit", "description": "Azure Active Directory OAuth2 Flow.", "scopes": { "user_impersonation": "impersonate your user account" } } }, "paths": { "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions": { "get": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_List", "description": "Lists all subscriptions of the API Management service instance.", "externalDocs": { "url": "https://msdn.microsoft.com/en-us/library/azure/dn776325.aspx" }, "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "name": "$filter", "in": "query", "required": false, "type": "string", "description": "| Field | Supported operators | Supported functions |\n|--------------|------------------------|---------------------------------------------|\n| id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |\n| name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |\n| stateComment | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |\n| userId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |\n| productId | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |\n| state | eq | |" }, { "$ref": "./apimanagement.json#/parameters/TopQueryParameter" }, { "$ref": "./apimanagement.json#/parameters/SkipQueryParameter" }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "A collection of the Subscription entities for the specified API Management service instance.", "schema": { "$ref": "#/definitions/SubscriptionCollection" } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } }, "x-ms-pageable": { "nextLinkName": "nextLink" }, "x-ms-odata": "#/definitions/SubscriptionContract" } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}": { "get": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_Get", "description": "Gets the specified Subscription entity.", "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "$ref": "#/parameters/SubscriptionEntityIdParameter" }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "200": { "description": "The response body contains the specified Subscription entity.", "schema": { "$ref": "#/definitions/SubscriptionContract" }, "headers": { "ETag": { "description": "Current entity state version. Should be treated as opaque and used to make conditional HTTP requests.", "type": "string" } } }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } } }, "put": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_CreateOrUpdate", "description": "Creates or updates the subscription of specified user to the specified product.", "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "$ref": "#/parameters/SubscriptionEntityIdParameter" }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/SubscriptionCreateParameters" }, "description": "Create parameters." }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "201": { "description": "The user was successfully subscribed to the product." }, "204": { "description": "The user already subscribed to the product." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } } }, "patch": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_Update", "description": "Updates the details of a subscription specified by its identifier.", "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "$ref": "#/parameters/SubscriptionEntityIdParameter" }, { "name": "parameters", "in": "body", "required": true, "schema": { "$ref": "#/definitions/SubscriptionUpdateParameters" }, "description": "Update parameters." }, { "name": "If-Match", "in": "header", "required": true, "description": "ETag of the Subscription Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.", "type": "string" }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "The subscription details were successfully updated." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } } }, "delete": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_Delete", "description": "Deletes the specified subscription.", "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "$ref": "#/parameters/SubscriptionEntityIdParameter" }, { "name": "If-Match", "in": "header", "required": true, "description": "ETag of the Subscription Entity. ETag should match the current entity state from the header response of the GET request or it should be * for unconditional update.", "type": "string" }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "The subscription details were successfully deleted." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regeneratePrimaryKey": { "post": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_RegeneratePrimaryKey", "description": "Regenerates primary key of existing subscription of the API Management service instance.", "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "$ref": "#/parameters/SubscriptionEntityIdParameter" }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "The primary key was successfully regenerated." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } } } }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/subscriptions/{sid}/regenerateSecondaryKey": { "post": { "tags": [ "Subscriptions" ], "operationId": "Subscriptions_RegenerateSecondaryKey", "description": "Regenerates secondary key of existing subscription of the API Management service instance.", "parameters": [ { "$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter" }, { "$ref": "./apimanagement.json#/parameters/ServiceNameParameter" }, { "$ref": "#/parameters/SubscriptionEntityIdParameter" }, { "$ref": "./apimanagement.json#/parameters/ApiVersionParameter" }, { "$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter" } ], "responses": { "204": { "description": "The secondary key was successfully regenerated." }, "default": { "description": "Error response describing why the operation failed.", "schema": { "$ref": "./apimanagement.json#/definitions/ErrorBodyContract" } } } } } }, "definitions": { "SubscriptionCollection": { "properties": { "value": { "type": "array", "items": { "$ref": "#/definitions/SubscriptionContract" }, "description": "Page values." }, "count": { "type": "integer", "format": "int64", "description": "Total record count number across all pages." }, "nextLink": { "type": "string", "description": "Next page link if any." } }, "description": "Paged Subscriptions list representation." }, "SubscriptionContract": { "properties": { "id": { "type": "string", "description": "Uniquely identifies the subscription within the current API Management service instance. The value is a valid relative URL in the format of /subscriptions/{sid} where {sid} is a subscription identifier.", "readOnly": true }, "userId": { "type": "string", "description": "The user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{uid} where {uid} is a user identifier." }, "productId": { "type": "string", "description": "The product resource identifier of the subscribed product. The value is a valid relative URL in the format of /products/{productId} where {productId} is a product identifier." }, "name": { "type": "string", "description": "The name of the subscription, or null if the subscription has no name.", "minLength": 0, "maxLength": 100 }, "state": { "type": "string", "description": "Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.", "enum": [ "Suspended", "Active", "Expired", "Submitted", "Rejected", "Cancelled" ], "x-ms-enum": { "name": "SubscriptionStateContract", "modelAsString": false } }, "createdDate": { "type": "string", "format": "date-time", "description": "Subscription creation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n", "readOnly": true }, "startDate": { "type": "string", "format": "date-time", "description": "Subscription activation date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n" }, "expirationDate": { "type": "string", "format": "date-time", "description": "Subscription expiration date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n" }, "endDate": { "type": "string", "format": "date-time", "description": "Date when subscription was cancelled or expired. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n" }, "notificationDate": { "type": "string", "format": "date-time", "description": "Upcoming subscription expiration notification date. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.\n" }, "primaryKey": { "type": "string", "description": "Subscription primary key.", "minLength": 1, "maxLength": 256 }, "secondaryKey": { "type": "string", "description": "Subscription secondary key.", "minLength": 1, "maxLength": 256 }, "stateComment": { "type": "string", "description": "Optional subscription comment added by an administrator." } }, "description": "Subscription details." }, "SubscriptionCreateParameters": { "properties": { "userId": { "type": "string", "description": "User (user id path) for whom subscription is being created in form /users/{uid}" }, "productId": { "type": "string", "description": "Product (product id path) for which subscription is being created in form /products/{productId}" }, "name": { "type": "string", "description": "Subscription name.", "minLength": 1, "maxLength": 100 }, "primaryKey": { "type": "string", "description": "Primary subscription key. If not specified during request key will be generated automatically.", "minLength": 1, "maxLength": 256 }, "secondaryKey": { "type": "string", "description": "Secondary subscription key. If not specified during request key will be generated automatically.", "minLength": 1, "maxLength": 256 }, "state": { "type": "string", "description": "Initial subscription state. If no value is specified, subscription is created with Submitted state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.", "enum": [ "Suspended", "Active", "Expired", "Submitted", "Rejected", "Cancelled" ], "x-ms-enum": { "name": "SubscriptionStateContract", "modelAsString": false } } }, "required": [ "userId", "productId", "name" ], "description": "Parameters supplied to the Create subscription operation." }, "SubscriptionUpdateParameters": { "properties": { "userId": { "type": "string", "description": "User identifier path: /users/{uid}" }, "productId": { "type": "string", "description": "Product identifier path: /products/{productId}" }, "expirationDate": { "type": "string", "format": "date-time", "description": "New subscription expiration date." }, "name": { "type": "string", "description": "Subscription name." }, "primaryKey": { "type": "string", "description": "Primary subscription key.", "minLength": 1, "maxLength": 256 }, "secondaryKey": { "type": "string", "description": "Secondary subscription key.", "minLength": 1, "maxLength": 256 }, "state": { "type": "string", "description": "Subscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated.", "enum": [ "Suspended", "Active", "Expired", "Submitted", "Rejected", "Cancelled" ], "x-ms-enum": { "name": "SubscriptionStateContract", "modelAsString": false } }, "stateComment": { "type": "string", "description": "Comments describing subscription state change by the administrator." } }, "description": "Parameters supplied to the Update subscription operation." } }, "parameters": { "SubscriptionEntityIdParameter": { "name": "sid", "in": "path", "required": true, "type": "string", "description": "Subscription entity Identifier. The entity represents the association between a user and a product in API Management.", "maxLength": 256, "pattern": "^[^*#&+:<>?]+$", "x-ms-parameter-location": "method" } } }