Developer documentation

Update product assignment

post https://app.iteras.dk/api/customers/updateproductassignment/

The /api/customers/updateproductassignment/ endpoint updates the data on a product assignment.

Parameters

  • id string required
    ID of the customer.
  • product_assignment_id string required
    ID of the product assignment, as returned by the customer data or assign product endpoint.
  • data object
    Any attributes to set on the product assignment. The valid attributes are the fields that are associated with the product assignment. Fields not mentioned in data are not touched; to delete a field, pass null.
  • reinvoice bool
    For a product assignment that is associated with a subscription (and not a period) this can be set to true if the update changes the pricing of the subscription to make the change take effect immediately. The system then credits the future part of the subscription (if it has been invoiced already) and sets it up to be invoiced.
  • exclude_from_webhooks bool Defaults to false
    Set to true to keep every event the request causes from being sent to webhooks, invoice and payment events included, e.g. "exclude_from_webhooks": true. The events are still added to the history.

You can set any custom product assignment field, using its field id (the field name with a colon prepended, or its external identifier).

Log in, or send your API key as a bearer token, to see the custom product assignment fields set up for your account.

A yes/no field (type bool) is true or false, and has no value when it isn't set. Set it with true or false, and clear it with null.

Examples

POST /api/customers/updateproductassignment/ HTTP/1.1
Content-Type: application/json{
  "id": "12345",
  "product_assignment_id": "9989892798",
  "data": {
    ":Custom product assignment field": "Example text",
    ":Obsolete field": null
  }
}

Return value

On success the endpoint returns the ID of the updated product assignment:

{ "product_assignment_id": "9989892798" }

Errors

Invalid requests due to programming error, e.g. invalid JSON, returns 400.

A well-formed operation where a supplied value is invalid is not executed and returns an HTTP 422 error. The response is a JSON object with the errors keyed by the field they concern, e.g. a custom product assignment field:

{
  ":Custom product assignment field": ["Enter a valid value."]
}

Errors that are not specific to a field are returned with the empty string as key, e.g. an unknown product assignment:

{
  "": ["Product assignment does not exist."]
}