REST API - Customizations
Last edit: Apr 10, 2020
Create
To create a customization send a POST request to /api/user/customizations
HTTP request
POST /api/user/customizations
Parameters
| Parameter | Type | Description | Required | Notes |
|---|---|---|---|---|
| form_name | String | Name of the form configuration | Required | underscored |
| form | CustomizationForm | CustomizationForm parameters that corresponds with Form configuration | Required | |
| parent_resource_id | ID (Int or String) | Id or name of definced CustomizationType | Required | name should be underscored |
Customization Parameters
| Parameter | Type | Description | Required | Notes |
|---|---|---|---|---|
| custom_addresses | Hash[String=>CustomAddressForm] | Custom addresses for this resource | Optional | |
| custom_attachments | Hash[String=>CustomAttachmentForm] | Custom attachments for this resource, such as pdf, doc | Optional | |
| custom_images | Hash[String=>CustomImageForm] | Custom images for this resource | Optional | |
| model_schema_name | String | Name (in snake case) of the associated Model Schema | Required | |
| customizable_id | Integer | Numeric identifier for the object to which the customization is attached | Optional | |
| customizable_type | String | Type of the object to which the customization is attached. Valid values: User UserProfile Instance | Optional | used in conjunction with customizable_id |
| customizations | Hash[String=>CustomizationForm] | Customizations for this resource | Optional | |
| id | Integer | Numeric identifier of the associated object | Optional | |
| properties | Hash[String=>Any] | Custom properties | Optional | |
| user_id | Integer | Numeric identifier for the object to which the customization is attached | Optional |
Example request
"Authorization: Token token=[YOUR API TOKEN]"
"Accept: application/json"
"Content-Type: application/json"
{
"form_name": "reference_rest_api_create_customization",
"parent_resource_id": "links",
"form": {
"properties": {
"url": "google.com"
}
}
}
| Element | Type | Description | Required? |
|---|---|---|---|
| form_name | String | Name of the defined Form | Required |
| form | CustomizationForm | Attributes for user, should match configuration defined in corresponding Form | Required |
Example response
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{
"id": 1,
"errors": {}
}
| Element | Type | Description |
|---|---|---|
| id | Integer | Object identifier |
| errors | Object | Validation errors |
Error and Status Codes
| Code | Message | Meaning |
|---|---|---|
| 201 | Created | Resource was created |
| 401 | Unathorized | Invalid Authentication |
| 406 | Not Acceptable | Wrong parameters passed |
| 422 | Unprocessable Entity | Wrong values, not matched validations |
Update
To update a customization, send a PUT request to /api/user/customizations/:customization_id
HTTP request
PUT /api/user/customizations/:customization_id
Parameters
| Parameter | Type | Description | Required | Notes |
|---|---|---|---|---|
| form_name | String | Name of the form configuration | Required | |
| form | CustomizationForm | CustomizationForm parameters that corresponds with Form configuration | Required |
Customization Parameters
| Parameter | Type | Description | Required | Notes |
|---|---|---|---|---|
| custom_addresses | Hash[String=>CustomAddressForm] | Custom addresses for this resource | Optional | |
| custom_attachments | Hash[String=>CustomAttachmentForm] | Custom attachments for this resource, such as pdf, doc | Optional | |
| custom_images | Hash[String=>CustomImageForm] | Custom images for this resource | Optional | |
| model_schema_name | String | Name (in snake case) of the associated Model Schema | Required | |
| customizable_id | Integer | Numeric identifier for the object to which the customization is attached | Optional | |
| customizable_type | String | Type of the object to which the customization is attached. Valid values: User UserProfile Instance | Optional | used in conjunction with customizable_id |
| customizations | Hash[String=>CustomizationForm] | Customizations for this resource | Optional | |
| id | Integer | Numeric identifier of the associated object | Optional | |
| properties | Hash[String=>Any] | Custom properties | Optional | |
| user_id | Integer | Numeric identifier for the object to which the customization is attached | Optional |
Example request
"Authorization: Token token=[YOUR API TOKEN]"
"Accept: application/json"
"Content-Type: application/json"
{
"form_name": "reference_rest_api_update_customization",
"form": {
"properties": {
"url": "aol.com"
}
}
}
| Element | Type | Description | Required? |
|---|---|---|---|
| form_name | String | Name of the defined Form | Required |
| form | CustomizationForm | Attributes for user, should match configuration defined in corresponding Form | Required |
Example response
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
{}
Error and Status Codes
| Code | Message | Meaning |
|---|---|---|
| 204 | No Content | Successfully fulfilled request |
| 401 | Unathorized | Invalid Authentication |
| 404 | Not Found | Can't find given resource |
| 406 | Not Acceptable | Wrong parameters passed |
Delete
To remove customization, send a DELETE request to /api/user/customizations/:customization_id
HTTP request
DELETE /api/user/customizations/:customization_id
Parameters
| Parameter | Type | Description | Required | Notes |
|---|---|---|---|---|
| form_name | String | Name of the form configuration | Required |
Example request
"Authorization: Token token=[YOUR API TOKEN]"
"Accept: application/json"
"Content-Type: application/json"
{
"form_name": "reference_rest_api_delete_customizations"
}
| Element | Type | Description | Required? |
|---|---|---|---|
| form_name | String | Name of the defined Form | Required |
Example response
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
Error and Status Codes
| Code | Message | Meaning |
|---|---|---|
| 204 | No Content | Successfully fulfilled request |
| 401 | Unathorized | Invalid Authentication |
| 406 | Not Acceptable | Wrong parameters passed |