Create a membership profile
How to create a membership profile via API
To create a new membership profile, send a POST request to the /api/membership_profiles endpoint, passing the resource arguments in the request body.
Request
POST https://provisioning.commercelayer.io/api/membership_profiles
Arguments
Body Parameter
Type
Required
type
string
Required
attributes.name
string
Required
attributes.access_scope
string
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.organization
object
Required
relationships.application_memberships
array
Optional
Example
The following request creates a new membership profile:
curl -g -X POST \
'https://provisioning.commercelayer.io/api/membership_profiles' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {{your_access_token}}' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "membership_profiles",
"attributes": {
"name": "Marketing group",
"access_scope": "live_access"
},
"relationships": {
"organization": {
"data": {
"type": "organizations",
"id": "ABCRtyUpBa"
}
}
}
}
}'On success, the API responds with a 201 Created status code, returning the created resource object:
{
"data": {
"id": "xYZkjABcde",
"type": "membership_profiles",
"links": {
"self": "https://provisioning.commercelayer.io/api/membership_profiles/xYZkjABcde"
},
"attributes": {
"name": "Marketing group",
"test_enabled": false,
"access_scope": "live_access",
"created_at": "2018-01-01T12:00:00.000Z",
"updated_at": "2018-01-01T12:00:00.000Z",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"metadata": {
"foo": "bar"
}
},
"relationships": {
"organization": {
"links": {
"self": "https://provisioning.commercelayer.io/api/membership_profiles/xYZkjABcde/relationships/organization",
"related": "https://provisioning.commercelayer.io/api/membership_profiles/xYZkjABcde/organization"
}
},
"application_memberships": {
"links": {
"self": "https://provisioning.commercelayer.io/api/membership_profiles/xYZkjABcde/relationships/application_memberships",
"related": "https://provisioning.commercelayer.io/api/membership_profiles/xYZkjABcde/application_memberships"
}
}
}
}
}Last updated

