Sections

Sections are another way to make your SellApp storefront more navigable — they allow you to subdivide your storefront into overviewable parts/sections to streamline the customer browsing experience.

On this page, we'll dive into the different section endpoints you can use to manage sections programmatically. We'll look at how to create, update, and delete sections.

The section model

The section model contains all the information about the sections stores have, including the type, code, and discount amount.

Properties

  • Name
    id
    Type
    integer
    Description

    The unique identifier for the section.

  • Name
    title
    Type
    string
    Description

    The section title.

  • Name
    slug
    Type
    string
    Description

    The section slug.

  • Name
    hidden
    Type
    boolean
    Description

    The section visibility. One of two values:

    • false: Section is not hidden and can be seen publicly.
    • true: Section is hidden and can only be seen via direct link.
  • Name
    order
    Type
    integer
    Description

    The order of the section.

  • Name
    created_at
    Type
    timestamp
    Description

    The time at which this section was first created.

  • Name
    updated_at
    Type
    timestamp
    Description

    The time at which this section was last updated.

  • Name
    store_id
    Type
    integer
    Description

    The ID of the store this section belongs to.

  • Name
    groups_linked
    Type
    integer
    Description

    The amount of groups linked to the section.

  • Name
    products_linked
    Type
    integer
    Description

    The amount of products linked to the section.

  • Name
    groups
    Type
    array
    Description

    An array of groups linked to the section, containing three types of info:

    • id: The group ID.
    • title: The group title.
    • group_product: The amount of products linked to the group.
  • Name
    products
    Type
    array
    Description

    An array of products linked to the section, containing three types of info:

    • id: The product ID.
    • title: The product title.
    • description: The product description.

GET/v1/sections

List all sections

This endpoint allows you to retrieve a paginated list of all your sections. By default, a maximum of fifteen sections are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of sections returned

  • Name
    page
    Type
    integer
    Description

    The page number you are attempting to access.

Request

GET
/v1/sections
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/sections');
$request->setRequestMethod('GET');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "data": [
    {
      "id": 1,
      "title": "Dissection",
      "slug": "dissection",
      "hidden": false,
      "order": 1,
      "created_at": "2022-12-12T12:12:12.000000Z",
      "updated_at": "2022-12-12T12:12:12.000000Z",
      "store_id": 1,
      "groups_linked": 1,
      "products_linked": 1,
      "groups": [
        {
          "id": 1,
          "title": "Rat race",
          "group_products": 1
        }
      ],
      "products": [
        {
          "id": "1",
          "title": "This will make me rich!",
          "description": "I am sure of it, Pinky."
        }
      ]
    }
  ],
  "links": {
    // ...
  },
  "meta": {
    // ...
  }
}

POST/v1/sections

Create a section

This endpoint allows you to create a new section. See the code examples for how to create a new section with the SellApp API.

Required attributes

  • Name
    title
    Type
    string
    Description

    The section title.

  • Name
    slug
    Type
    string
    Description

    The section slug.

  • Name
    hidden
    Type
    boolean
    Description

    The section visibility. One of two values:

    • false: Section is not hidden and can be seen publicly.
    • true: Section is hidden and can only be seen via direct link.

Optional attributes

  • Name
    order
    Type
    integer
    Description

    The section's order.

Request

POST
/v1/sections
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "title": "Developer Goodies",
  "slug": "developer-goodies",
  "hidden": false
}');

$request->setRequestUrl('https://sell.app/api/v1/sections');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "id": 2,
  "title": "Developer Goodies",
  "slug": "developer-goodies",
  "hidden": false,
  "order": 1,
  "created_at": "2022-12-12T12:12:12.000000Z",
  "updated_at": "2022-12-12T12:12:12.000000Z",
  "store_id": 1,
  "groups_linked": 0,
  "products_linked": 0,
  "groups": [],
  "products": []
}

GET/v1/sections/:id

Retrieve a section

This endpoint allows you to retrieve a specific section by providing the unique identifier. Refer to the list at the top of this page to see which properties are included with section objects.

Request

GET
/v1/sections/:id
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/sections/1');
$request->setRequestMethod('GET');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "id": 1,
  "title": "Dissection",
  "slug": "dissection",
  "hidden": false,
  "order": 1,
  "created_at": "2022-12-12T12:12:12.000000Z",
  "updated_at": "2022-12-12T12:12:12.000000Z",
  "store_id": 1,
  "groups_linked": 1,
  "products_linked": 1,
  "groups": [
    {
      "id": 1,
      "title": "Rat race",
      "group_products": 1
    }
  ],
  "products": [
    {
      "id": "1",
      "title": "This will make me rich!",
      "description": "I am sure of it, Pinky."
    }
  ]
}

PATCH/v1/sections/:id

Update a section

This endpoint allows you to perform an update on a section.

Optional attributes

  • Name
    title
    Type
    string
    Description

    The section title.

  • Name
    slug
    Type
    string
    Description

    The section slug.

  • Name
    hidden
    Type
    boolean
    Description

    The section visibility. One of two values:

    • false: Section is not hidden and can be seen publicly.
    • true: Section is hidden and can only be seen via direct link.
  • Name
    order
    Type
    integer
    Description

    The section's order.

Request

PATCH
/v1/sections/:id
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "title": "Developer goodies V2",
  "slug": "developer-goodies-v2",
  "hidden": false
}');

$request->setRequestUrl('https://sell.app/api/v1/sections/2');
$request->setRequestMethod('PATCH');
$request->setBody($body);

$request->setHeaders([
  'Content-Type' => 'application/json',
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Response

{
  "id": 2,
  "title": "Developer Goodies V2",
  "slug": "developer-goodies-v2",
  "hidden": false,
  "order": 1,
  "created_at": "2022-12-12T12:12:12.000000Z",
  "updated_at": "2022-12-12T12:12:12.000000Z",
  "store_id": 1,
  "groups_linked": 0,
  "products_linked": 0,
  "groups": [],
  "products": []
}

DELETE/v1/sections/:id

Delete a section

This endpoint allows you to delete a section.

Request

DELETE
/v1/sections/:id
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v1/sections/1');
$request->setRequestMethod('DELETE');
$request->setHeaders([
  'accept' => 'application/json',
  'Authorization' => 'Bearer {ApiKeyHere}'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();