Several API resources for our v2 REST API have a user-defined-fields
attribute. You can make GET requests to find UDFs and POST/PATCH requests to set or update UDFs:
/services/v2/addresses
/services/v2/addresses/{id}
/services/v2/customer
/services/v2/customers
/services/v2/customers/{id}
/services/v2/group-subscription
/services/v2/group-subscriptions
/services/v2/group-subscriptions/{id}
/services/v2/group-subscription-template
/services/v2/group-subscription-templates
/services/v2/group-subscription-templates/{id}
/services/v2/products
/services/v2/products/{id}
/services/v2/subscription
/services/v2/subscriptions
/services/v2/subscriptions/{id}
For example, let’s say you wanted to update the birthday
user defined field on a customer’s address. You could make an API call like this
curl -X PATCH "https://api.subscribepro.com/services/v2/addresses/123" \
-H 'Authorization: Bearer XXXXXX' \
-d '[{"op": "add","path": "/user_defined_fields/birthday","value": "1985-01-01"}]'
Then, you could get the customer’s address data including that UDF value with an API request like this:
curl -X GET "https://api.subscribepro.com/services/v2/addresses/123" \
-H 'Authorization: Bearer XXXXXX'
When User Defined Fields are set or updated via the API, we only validate that the UDF data is valid JSON. When UDF fields with the “Validate Data” setting are edited through the SubscribePro application, we will enforce the validation rules for that field.