Skip to content

Provision

/userproducts

Target audience: Developers

Provision subscription

Introduction

This endpoint lets you provision a user-product for a 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

Provision service Your API user must have a provision service defined. You define this in PAP.

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"
package_code Required String The package or campaign-code for the package/campaign to provision.
Size range: ..50
Allowed values: "/^[a-zA-Z-_0-9]+$/"
subscription_type Required String Allowed values: "recurring", "limited"
valid_from Required DateTime The package should be active and valid from this date and time
valid_to Required DateTime The package should be active and valid to this date and time

Curl Example

curl --request POST \
  --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",
            "package_code": "adeprimo_digital",
            "subscription_type", "limited",
            "valid_from": "2016-10-02 13:00 +0100",
            "valid_to": "2016-11-02 13:00 +0100",
          }'

Response

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

Example Response

HTTP 201 Created
{
  "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 404 Account Not Found

Name Type Description
not_found Object The account could not be found

HTTP 404 Package Not Found

Name Type Description
not_found Object The account could not be found

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side