Subscription (Individual)


Add a new subscription

POST https://apis.wso2.com/api/am/store/v0.13/subscriptions

This operation can be used to add a new subscription providing the id of the API and the application.

OAuth 2.0 Scope

apim:subscribei

Request

POST https://localhost:9443/api/am/store/v0.13/subscriptions Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 { "tier": "Gold", "apiIdentifier": "c43a325c-260b-4302-81cb-768eafaa3aed", "applicationId": "c30f3a6e-ffa4-4ae7-afce-224d1f820524" }

Response

HTTP/1.1 201 Created Location: https://localhost:9443/api/am/store/v0.13/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9 Content-Type: application/json { "tier": "Gold", "subscriptionId": "5b65808c-cdf2-43e1-a695-de63e3ad0ae9", "apiIdentifier": "admin-PhoneVerification-2.0.0", "applicationId": "c30f3a6e-ffa4-4ae7-afce-224d1f820524", "status": "UNBLOCKED" }

Sample CURL

curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -H "Content-Type: application/json" -X POST -d @data.json "https://localhost:9443/api/am/store/v0.13/subscriptions"

Parameters

Type Name Description Schema Default
Body

body

required

Subscription object that should to be added

Subscription (Subscription)

Header

Content-Type

required

Media type of the entity in the body. Default is application/json.

String

application/json

Responses

HTTP Code Description Schema

201

Created. Successful response with the newly created object as entity in the body. Location header contains URL of newly created entity.

Subscription

400

Bad Request. Invalid request or validation error.

Error

415

Unsupported media type. The entity of the request was in a not supported format.


Remove a subscription

DELETE https://apis.wso2.com/api/am/store/v0.13/subscriptions/{subscriptionId}

This operation can be used to remove a subscription.

OAuth 2.0 Scope

apim:subscribei

Request

DELETE https://localhost:9443/api/am/store/v0.13/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9

Response

HTTP/1.1 200 OK

Sample CURL

curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -X DELETE "https://localhost:9443/api/am/store/v0.13/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9"

Parameters

Type Name Description Schema Default
Path

subscriptionId

required

Subscription Id

String

Header

If-Match

optional

Validator for conditional requests; based on ETag.

String

Header

If-Unmodified-Since

optional

Validator for conditional requests; based on Last Modified header (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Resource successfully deleted.

404

Not Found. Resource to be deleted does not exist.

Error

412

Precondition Failed. The request has not been performed because one of the preconditions is not met.

Error

Get details of a subscription

GET https://apis.wso2.com/api/am/store/v0.13/subscriptions/{subscriptionId}

This operation can be used to get details of a single subscription.

OAuth 2.0 Scope

apim:subscribei

Request

GET https://localhost:9443/api/am/store/v0.13/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9 Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

Response

HTTP/1.1 200 OK Content-Type: application/json { "tier": "Gold", "subscriptionId": "5b65808c-cdf2-43e1-a695-de63e3ad0ae9", "apiIdentifier": "admin-PhoneVerification-2.0.0", "applicationId": "c30f3a6e-ffa4-4ae7-afce-224d1f820524", "status": "UNBLOCKED" }

Sample CURL

curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" "https://localhost:9443/api/am/store/v0.13/subscriptions/5b65808c-cdf2-43e1-a695-de63e3ad0ae9"

Parameters

Type Name Description Schema Default
Path

subscriptionId

required

Subscription Id

String

Header

Accept

optional

Media types acceptable for the response. Default is application/json.

String

application/json

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resource.

String

Header

If-Modified-Since

optional

Validator for conditional requests; based on Last Modified header of the formerly retrieved variant of the resource (Will be supported in future).

String

Responses

HTTP Code Description Schema

200

OK. Subscription returned

Subscription

304

Not Modified. Empty body because the client has already the latest version of the requested resource.

404

Not Found. Requested Subscription does not exist.

Error