Create a Custom Field
POSThttps://useast.api.elasticpath.com/v2/settings/extensions/custom-apis/:customApiId/fields
Create a Custom Field
Request
Path Parameters
customApiId uuidrequired
The id of the Custom API.
Example: 3fa85f64-5717-4562-b3fc-2c963f66afa6
- application/json
Body
data object required
Responses
- 201
- 400
- 409
- default
Created
- application/json
- Schema
- Example (from schema)
- string_field
- integer_field
- boolean_field
- float_field
Schema
data object required
{}
String field example
{
"data": {
"type": "custom_field",
"name": "Name",
"description": "This field stores the name of the wishlist.",
"slug": "name",
"field_type": "string",
"validation": {
"string": {
"min_length": 3,
"max_length": 128,
"regex": null,
"allow_null_values": true
}
},
"id": "859aeba1-03c2-4822-bd4c-89afce93d7eb",
"links": {
"self": "/settings/extensions/custom-apis/3fa85f64-5717-4562-b3fc-2c963f66afa6/fields/859aeba1-03c2-4822-bd4c-89afce93d7eb"
},
"meta": {
"timestamps": {
"created_at": "2017-01-10T11:41:19.244Z",
"updated_at": "2017-01-10T11:41:19.244Z"
}
}
}
}
Integer field example
{
"data": {
"type": "custom_field",
"name": "Items Count",
"description": "This field stores the total count of items in the wishlist.",
"slug": "items_count",
"field_type": "integer",
"validation": {
"integer": {
"min_value": 0,
"max_value": null,
"allow_null_values": true
}
},
"id": "859aeba1-03c2-4822-bd4c-89afce93d7eb",
"links": {
"self": "/settings/extensions/custom-apis/3fa85f64-5717-4562-b3fc-2c963f66afa6/fields/859aeba1-03c2-4822-bd4c-89afce93d7eb"
},
"meta": {
"timestamps": {
"created_at": "2017-01-10T11:41:19.244Z",
"updated_at": "2017-01-10T11:41:19.244Z"
}
}
}
}
Boolean field example
{
"data": {
"type": "custom_field",
"name": "Keep Purchased Items",
"description": "This field stores whether or not to keep purchased items on the wishlist.",
"slug": "keep_purchased",
"field_type": "boolean",
"validation": {
"boolean": {
"allow_null_values": true
}
},
"id": "859aeba1-03c2-4822-bd4c-89afce93d7eb",
"links": {
"self": "/settings/extensions/custom-apis/3fa85f64-5717-4562-b3fc-2c963f66afa6/fields/859aeba1-03c2-4822-bd4c-89afce93d7eb"
},
"meta": {
"timestamps": {
"created_at": "2017-01-10T11:41:19.244Z",
"updated_at": "2017-01-10T11:41:19.244Z"
}
}
}
}
Float field example
{
"data": {
"type": "custom_field",
"name": "Items Weight",
"description": "This field stores the total weight (in kilograms) of the items in the wishlist.",
"slug": "items_weight",
"field_type": "float",
"validation": {
"float": {
"min_value": 0.0,
"max_value": null,
"allow_null_values": true
}
},
"id": "859aeba1-03c2-4822-bd4c-89afce93d7eb",
"links": {
"self": "/settings/extensions/custom-apis/3fa85f64-5717-4562-b3fc-2c963f66afa6/fields/859aeba1-03c2-4822-bd4c-89afce93d7eb"
},
"meta": {
"timestamps": {
"created_at": "2017-01-10T11:41:19.244Z",
"updated_at": "2017-01-10T11:41:19.244Z"
}
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
errors Error[]required
{
"errors": [
{
"title": "string",
"status": "string",
"detail": "string"
}
]
}
Required field missing
{
"errors": [
{
"title": "Bad Request",
"status": "400",
"detail": "The field 'name' is required."
}
]
}
Unable to perform the operation at this time.
- application/json
- Schema
- Example (from schema)
- duplicate-custom-api
- duplicate-custom-field
Schema
errors Error[]required
{
"errors": [
{
"title": "string",
"status": "string",
"detail": "string"
}
]
}
Duplicate Custom API
{
"errors": [
{
"title": "Conflict",
"status": "409",
"detail": "custom_api with the given api_type already exists"
}
]
}
Duplicate Custom Field
{
"errors": [
{
"title": "Conflict",
"status": "409",
"detail": "custom_field with the given slug already exists"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
errors Error[]required
{
"errors": [
{
"title": "string",
"status": "string",
"detail": "string"
}
]
}
Internal server error
{
"errors": [
{
"title": "Internal Server Error",
"status": "500",
"detail": "there was a problem processing your request"
}
]
}
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X GET 'https://useast.api.elasticpath.com' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
ResponseClear