Skip to content

Update

/userproducts

Target audience: Developers

Update subscription

Introduction

Update existing user-product for specified account

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/userproducts
Production https://backend.worldoftulo.com/external/api/v1/userproducts

Requirements

Identity Scope
No /external/userproduct/w

Parameters

Field Required Type Description
account_id Required String The id of the account to provision the user product for.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
product_id Required String The id of the product to update.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
subscription_type Optional String Allowed values: "recurring", "limited"
state Optional String State of the user-product.
Allowed values: "activated", "deactivated"
valid_from Optional DateTime The package should be active and valid from this date and time
valid_to Optional DateTime The package should be active and valid to this date and time

Curl Example

curl --request PUT \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/userproducts \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
            "account_id": "52a781d6400e06897c00000f",
            "product_id": "56e1741a6fc9365306000002",
            "subscription_type", "limited",
            "valid_from": "2016-10-02 13:00 +0100",
            "valid_to": "2016-11-02 13:00 +0100",
            "state": "activated"
          }'

Response

Field Description
id The unique id of the provisioned user-product.

Example Response: Successfully updated user-product

HTTP 200
{
    "id": "56e1741a6fc9365306000002"
}

Errors

Example error response

HTTP 400 Bad Request
{
    "code": "invalid_parameter",
    "field": "account_id",
    "message": "Parameter must match format (/^[a-f\d]{24}$/)"
}

HTTP 400 Bad Request

Name Type Description
invalid_parameter Object Validation error on any of the fields in the posted json
json_parser_error Object The request body could not be parsed as valid json
invalid_content_type_error Object The requests Content-Type header isn't set to application/json
unknown_parameter Object One or more of the fields in the posted json was not recognized
configuration_error Object API user not configured correctly, if this happens, contact the Tulo Payway team

HTTP 403 Forbidden

Name Type Description
not_product_owner Object The user-product with expected external provision-service was not found

HTTP 404 Account Not Found

Name Type Description
not_found Object The account could not be found

HTTP 404 UserProduct Not Found

Name Type Description
not_found Object The user-product could not be found

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side