Skip to main content

Commerce Extensions

Creating Custom APIs

  1. Go to COMMERCE EXTENSIONS > Custom APIs.
  2. Select Create New.
  3. In the Basic Details section:
    1. Name: Enter the the name of the Custom API. It must be between 1 and 255 characters.
    2. Description: Provide a description for the Custom API.
  4. In the Advanced Options section:
    1. API Type: Specify the type of the Custom API.
    2. Slug: Enter a unique slug identifier for the Custom API.
    3. (Optional) In Settings, select the checkbox for Allow UPSERT so the system can automatically create a new record if it doesn't exist when updating. For more details, see Upsert Custom API Entries.
  5. Select Create Custom API.

Creating Custom Fields

To create a Custom Field for a Custom API, follow these steps:

  1. Go to COMMERCE EXTENSIONS > Custom APIs.

  2. Select Create Field and choose one of these field types:

    • String
    • Integer
    • Boolean
    • Float
  3. In the Basic Details section:

    1. Name: Enter the field name. It must be between 1 and 255 characters.
    2. Description: Provide a description for the field.
    3. Slug: Enter a unique slug identifier for the field.
  4. (Optional) In Settings section, select the checkbox for Use as the URL of entry record. This option is shown only when you select String field type. When this option is enabled, the value of this field will be used as the URL slug for entries created in the Custom API. This field must be a String, unique, and cannot allow null value. The Custom API must not have any existing entries.

  5. (Optional) In Settings section, set Sort Order of your field. This option allows you to prioritize the order in which fields are presented in the user interface. Fields with a higher value will appear first. The value must be between 0 and 1000.

  6. In the Validation section:

    1. Set the value rules from the drop-down lists:
      • Can be NULL or Cannot be NULL. This option is disabled when you select Use as the URL of entry record.
      • Can be changed or Cannot be changed
      • For String fields, choose among Is unique and case sensitive, Does not need to be unique, or Is unique and case insensitive. The Does not need to be unique option is disabled when you select Use as the URL of entry record.
    2. (For String fields) Under Character Limit, enter Minimum Length and Maximum Length.
    3. (For Integer and Float fields) Under Input Range, enter Minimum Value and Maximum Value.
    4. (For String fields) In the Regular Expression field, enter a less than 1024 character RE2 regular expression to restrict the specific characters that can be stored.
  7. Select Create Field.

Creating Custom API Entries

To create a Custom API Entry for a Custom API, follow these steps:

  1. Go to COMMERCE EXTENSIONS > Custom APIs.
  2. In the Actions column, click the button associated with the target Custom API and click View Entries option.
  3. Select Create Entry.
  4. Fill out the values for the configured Custom Fields as desired.
  5. Select Create Entry.