Create a Custom API
POST/v2/settings/extensions/custom-apis
Create a Custom API
Request
- application/json
Body
- Array [
- ]
data CustomApiAttributesrequired
Specifies the type of the resource object, use custom_api
for Custom APIs.
Possible values: non-empty
and <= 255 characters
Specifies the name of this Custom API.
Possible values: <= 255 characters
Specifies the description for this Custom API.
Possible values: Value must match regular expression ^[a-z0-9_-]{1,63}$
Specifies a unique slug identifier for the Custom API. The API Entries for the created Custom API will be accessible at the location /v2/extensions/<slug>
.
Possible values: Value must match regular expression ^[a-z0-9_]{1,59}_ext$
Specifies a unique API type for this Custom API. Entries for this API will use this value for their type
field. This field must be suffixed with _ext
to distinguish it from built in APIs.
Controls whether upsert operations are allowed for Custom API Entries via the PUT
method. When set to true
, it allows the creation of new Custom API Entries using PUT
if the record doesn't exist, and updates the existing record if it does. When false
, PUT
requests can only update existing entries.
links object
meta object
timestamps objectrequired
relationships object
parent_apis objectrequired
data object[]required
The unique identifier for the related Custom API. When the type
of an object is set to api_location
then id
must be /v2/extensions
.
When the type
of an object is set to custom_api
, then id
must be that of a Custom API that results in a relationship that does not have a depth exceeding 2 and does not result in a cycle.
Possible values: [custom_api
, api_location
]
Specifies the type of parent relationship, can be custom_api
or api_location
.
Responses
- 201
- 400
- 409
- 500
Created
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
data objectrequired
The unique identifier for the Custom API.
Specifies the type of the resource object, use custom_api
for Custom APIs.
Possible values: non-empty
and <= 255 characters
Specifies the name of this Custom API.
Possible values: <= 255 characters
Specifies the description for this Custom API.
Possible values: Value must match regular expression ^[a-z0-9_-]{1,63}$
Specifies a unique slug identifier for the Custom API. The API Entries for the created Custom API will be accessible at the location /v2/extensions/<slug>
.
Possible values: Value must match regular expression ^[a-z0-9_]{1,59}_ext$
Specifies a unique API type for this Custom API. Entries for this API will use this value for their type
field. This field must be suffixed with _ext
to distinguish it from built in APIs.
Controls whether upsert operations are allowed for Custom API Entries via the PUT
method. When set to true
, it allows the creation of new Custom API Entries using PUT
if the record doesn't exist, and updates the existing record if it does. When false
, PUT
requests can only update existing entries.
links objectrequired
Specifies the URI of the Custom API.
meta object
timestamps objectrequired
Specifies the date the entity is created.
Specifies the date the entity is last updated.
relationships objectrequired
parent_apis objectrequired
data object[]required
The unique identifier for the related Custom API. When the type
of an object is set to api_location
then id
must be /v2/extensions
.
When the type
of an object is set to custom_api
, then id
must be that of a Custom API that results in a relationship that does not have a depth exceeding 2 and does not result in a cycle.
Possible values: [custom_api
, api_location
]
Specifies the type of parent relationship, can be custom_api
or api_location
.
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "string",
"name": "string",
"description": "string",
"slug": "string",
"api_type": "string",
"allow_upserts": false,
"links": {
"self": "/settings/extensions/custom-apis/3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
"meta": {
"timestamps": {
"updated_at": "2017-01-10T11:41:19.244Z",
"created_at": "2017-01-10T11:41:19.244Z"
}
},
"relationships": {
"parent_apis": {
"data": [
{
"id": "652e39d8-d613-493e-8c20-fef99ad6327a",
"type": "custom_api"
}
]
}
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
- Array [
- ]
errors Error[]required
A brief summary of the error.
The HTTP response code of the error.
Optional additional detail about the error.
{
"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
- Array [
- ]
errors Error[]required
A brief summary of the error.
The HTTP response code of the error.
Optional additional detail about the error.
{
"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
- Array [
- ]
errors Error[]required
A brief summary of the error.
The HTTP response code of the error.
Optional additional detail about the error.
{
"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"
}
]
}