Skip to main content

Update a Custom API

PUT 

https://useast.api.elasticpath.com/v2/settings/extensions/custom-apis/:custom_api_id

Update a Custom API

Request

Path Parameters

    custom_api_id stringrequired

    The id of the Custom API.

    Example: 3fa85f64-5717-4562-b3fc-2c963f66afa6

Body

    data CustomApiAttributesrequired
    typestringrequired

    Specifies the type of the resource object, use custom_api for Custom APIs.

    namestring

    Specifies the name of this Custom API.

    Possible values: non-empty and <= 255 characters

    descriptionstring

    Specifies the description for this Custom API.

    Possible values: <= 255 characters

    slugstring

    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,63}$

    api_typestring

    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.

    Possible values: Value must match regular expression ^[a-z0-9_]{1,59}_ext$

    allow_upsertsboolean

    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.

    Default value: false

Responses

OK

Schema
    data objectrequired
    iduuid

    The unique identifier for the Custom API.

    typestring

    Specifies the type of the resource object, use custom_api for Custom APIs.

    namestring

    Specifies the name of this Custom API.

    Possible values: non-empty and <= 255 characters

    descriptionstring

    Specifies the description for this Custom API.

    Possible values: <= 255 characters

    slugstring

    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,63}$

    api_typestring

    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.

    Possible values: Value must match regular expression ^[a-z0-9_]{1,59}_ext$

    allow_upsertsboolean

    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.

    Default value: false
    links object
    selfuri

    Specifies the URI of the Custom API.

    Example: /settings/extensions/custom-apis/3fa85f64-5717-4562-b3fc-2c963f66afa6
    meta object
    timestamps objectrequired
    updated_atstringrequired

    Specifies the date the entity is created.

    Example: 2017-01-10T11:41:19.244Z
    created_atstringrequired

    Specifies the date the entity is last updated.

    Example: 2017-01-10T11:41:19.244Z
    relationships object
    parent_apis objectrequired
    data object[]required
  • Array [
  • idstringrequired

    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.

    Example: 652e39d8-d613-493e-8c20-fef99ad6327a
    typestringrequired

    Specifies the type of parent relationship, can be custom_api or api_location.

    Possible values: [custom_api, api_location]

  • ]

Authorization: http

name: bearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://useast.api.elasticpath.com/v2/settings/extensions/custom-apis/:custom_api_id");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\",\n \"slug\": \"string\",\n \"api_type\": \"string\",\n \"allow_upserts\": false\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://useast.api.elasticpath.com
Auth
Parameters
— pathrequired
Body
{
  "data": {
    "type": "string",
    "name": "string",
    "description": "string",
    "slug": "string",
    "api_type": "string",
    "allow_upserts": false
  }
}
ResponseClear

Click the Send API Request button above and see the response here!

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.