Update subscription state
/apiplatform/management/v1/plans/{planId}/subscriptions/{subId}/state
Updates the state of the {subId}
subscription for the {planId}
plan.
Users requesting this resource must be assigned the API Manager, Plan Manager or Application Developer role. If the current subscription state is REQUESTING
, the user must be issued the Manage Plan grant for the associated API. For all other states, the user must be issued the Manage API, Sunscribe, or Manage Subscribed Application grant to the associated API/plan.
Request
- application/json
-
planId: string
A unique ID referencing a specific plan.
-
subId: string
A unique ID referencing a specific subscription.
object
-
state:
string
The subscription's state. Valid values depend on the current subscription state. If the state is
REQUESTING
, it can be updated toREJECTED
,SUBSCRIBED
, orSUSPENDED
. If the state isSUBSCRIBED
, it can be updated toSUSPENDED
. If the state isSUSPENDED
, it can be updated toSUBSCRIBED
. If the state isREJECTED
, it can't be updated. -
stateComments(optional):
string
Comments regarding the subscription's state.
Response
- application/json
200 Response
403 Response
object
-
detail(optional):
string
Detailed error message
-
errorCode(optional):
string
Application specific error code
-
errorDetails(optional):
array errorDetails
additional errors
-
errorPath(optional):
string
-
instance(optional):
string
URI to the link that provides more detail about the error
-
status(optional):
string
HTTP status code
-
title:
string
Summary error message
-
type:
string
Error type
500 Response
object
-
detail(optional):
string
Detailed error message
-
errorCode(optional):
string
Application specific error code
-
errorDetails(optional):
array errorDetails
additional errors
-
errorPath(optional):
string
-
instance(optional):
string
URI to the link that provides more detail about the error
-
status(optional):
string
HTTP status code
-
title:
string
Summary error message
-
type:
string
Error type
Examples
The following example shows how to update the state of a subscription to a plan by submitting a PUT request on the REST resource using cURL. For more information about cURL, see Use cURL
curl -i -X PUT
-H "Content-Type:application/json"
-d @sub-state.json
-H "Authorization: Bearer access_token"
https://example.com/apiplatform/management/v1/plans/{planId}/subscriptions/{subId}/state
-
{planId}
is the unique Id for a plan. To retrieve available plan Ids, see Get plans. -
{subId}
is the unique Id for a subscription. To retrieve available subscription Ids, see Get subscriptions.
Example of Request Body
The following shows an example of the request body in JSON format, included with the request above in a file named sub-state.json
.
{ "state":"SUBSCRIBED", "stateComments": "Approving subscription" }
Valid states depend on the existing state of the subscription:
-
If the existing state is SUBSCRIBED, you can change the state to SUSPENDED.
-
If the existing state is REQUESTING, you can change the state to REJECTED, SUBSCRIBED, or SUSPENDED.
-
If the existing state is SUSPENDED you can change the state to SUBSCRIBED.
-
If the existing state is REJECTED, you can not update the state.
Example of Response Headers
The following shows an example of the response headers.
HTTP/1.1 204 No Content Server: Oracle-Traffic-Director/12.2.1.0.0 Date: Wed, 15 Mar 2017 05:59:59 GMT X-oracle-dms-ecid: f102c33f-1c5b-4409-806d-03bf5706c492-000219fc X-oracle-dms-rid: 0:1 Via: 1.1 otd_opc Proxy-agent: Oracle-Traffic-Director/12.2.1.0.0