Groups

Groups are a way to help make your storefront navigable in SellApp — they are a collection of products you've grouped together in a tidy bunch.

On this page, we'll dive into the different group endpoints you can use to manage groups programmatically. We'll look at how to query, create, update, and delete groups, as well as how to add and remove products within groups.

The group model

The group model contains all the information about your groups, including what products are in the group and the group's name, description, and image.

Properties

  • Name
    id
    Type
    integer
    Description

    The unique identifier for the group.

  • Name
    title
    Type
    string
    Description

    The group title.

  • Name
    order
    Type
    integer
    Description

    The order rank of the group.

  • Name
    image
    Type
    object
    Description

    The image belonging to the group.

  • Name
    unlisted
    Type
    boolean
    Description

    Whether the group is unlisted or not. If set to true, the group will only be accessible via a direct link.

  • Name
    created_at
    Type
    timestamp
    Description

    The time at which this group was first created.

  • Name
    updated_at
    Type
    timestamp
    Description

    The time at which this group was last updated.

  • Name
    store_id
    Type
    integer
    Description

    The ID of the store this group belongs to.

  • Name
    section_id
    Type
    integer
    Description

    The ID of the section this group belongs to.

  • Name
    section_order
    Type
    integer
    Description

    The order rank of the group within the section it belongs to.

  • Name
    products_linked
    Type
    integer
    Description

    The amount of products linked to this group.

  • Name
    products
    Type
    array
    Description

    The products linked to this group, containing three types of info:

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

GET/v2/groups

List all groups

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

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of groups returned

  • Name
    page
    Type
    integer
    Description

    The page number you are attempting to access.

Request

GET
/v2/groups
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v2/groups');
$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": "Rat race",
      "order": 1,
      "image": null,
      "unlisted": false,
      "created_at": "2022-12-12T12:12:12.000000Z",
      "updated_at": "2022-12-12T12:12:12.000000Z",
      "store_id": 1,
      "section_id": null,
      "section_order": null,
      "products_linked": 1,
      "products": [
        {
          "id": "1",
          "title": "This will make me rich!",
          "description": "I am sure of it, Pinky."
        }
      ]
    }
  ],
  "links": {
    // ...
  },
  "meta": {
    // ...
  }
}

POST/v2/groups

Create a group

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

Required attributes

  • Name
    title
    Type
    string
    Description

    The group title.

  • Name
    order
    Type
    integer
    Description

    The order rank of the group.

  • Name
    unlisted
    Type
    boolean
    Description

    Whether the group is unlisted or not. If set to true, the group will only be accessible via a direct link.

Optional attributes

  • Name
    image
    Type
    object
    Description

    The image belonging to the group.

  • Name
    section_id
    Type
    integer
    Description

    The ID of the section this group belongs to.

  • Name
    section_order
    Type
    integer
    Description

    The order rank of the group within the section it belongs to.

Request

POST
/v2/groups
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "title": "Rat race",
  "order": 1,
  "unlisted": false
}');

$request->setRequestUrl('https://sell.app/api/v2/groups');
$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": 1,
  "title": "Rat race",
  "order": 1,
  "image": null,
  "unlisted": false,
  "created_at": "2022-12-12T12:12:12.000000Z",
  "updated_at": "2022-12-12T12:12:12.000000Z",
  "store_id": 1,
  "section_id": null,
  "section_order": null,
  "products_linked": 0,
  "products": []
}

GET/v2/groups/:id

Retrieve a group

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

Request

GET
/v2/groups/:id
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v2/groups/1');
$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": "Rat race",
      "order": 1,
      "image": null,
      "unlisted": false,
      "created_at": "2022-12-12T12:12:12.000000Z",
      "updated_at": "2022-12-12T12:12:12.000000Z",
      "store_id": 1,
      "section_id": null,
      "section_order": null,
      "products_linked": 1,
      "products": [
        {
          "id": "1",
          "title": "This will make me rich!",
          "description": "I am sure of it, Pinky."
        }
      ]
    }
  ],
  "links": {
    // ...
  },
  "meta": {
    // ...
  }
}

PATCH/v2/groups/:id

Update a group

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

Optional attributes

  • Name
    title
    Type
    string
    Description

    The group title.

  • Name
    order
    Type
    integer
    Description

    The order rank of the group.

  • Name
    unlisted
    Type
    boolean
    Description

    Whether the group is unlisted or not. If set to true, the group will only be accessible via a direct link.

  • Name
    image
    Type
    object
    Description

    The image belonging to the group.

  • Name
    section_id
    Type
    integer
    Description

    The ID of the section this group belongs to.

  • Name
    section_order
    Type
    integer
    Description

    The order rank of the group within the section it belongs to.

Request

PATCH
/v2/groups/:id
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "title": "Rat race",
  "order": 1,
  "unlisted": true
}');

$request->setRequestUrl('https://sell.app/api/v2/groups');
$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": 1,
  "title": "Rat race",
  "order": 1,
  "image": null,
  "unlisted": true,
  "created_at": "2022-12-12T12:12:12.000000Z",
  "updated_at": "2022-12-12T12:12:12.000000Z",
  "store_id": 1,
  "section_id": null,
  "section_order": null,
  "products_linked": 0,
  "products": []
}

DELETE/v2/groups/:id

Delete a group

This endpoint allows you to delete a group.

Request

DELETE
/v2/groups/:id
$client = new http\Client;
$request = new http\Client\Request;

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

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

echo $response->getBody();

POST/v2/groups/:id/products/attach

Add products to group

This endpoint allows you to add products to an existing group. See the code examples for how to add products to an existing group with the SellApp API.

Required attributes

  • Name
    resources
    Type
    array
    Description

    Array of product ID's you want to attach to the group

Request

POST
/v2/groups/:id/products/attach
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "resources": [1]
}');

$request->setRequestUrl('https://sell.app/api/v2/groups/1/products/attach');
$request->setRequestMethod('POST');
$request->setBody($body);

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

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

echo $response->getBody();

Response

{
  "attached": [
    1
  ]
}

DELETE/v2/groups/:id/products/detach

Remove products from group

This endpoint allows you to remove products from a group.

Required attributes

  • Name
    resources
    Type
    array
    Description

    Array of product ID's you want to detach from the group

Request

DELETE
/v2/groups/:id/products/detach
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "resources": [1]
}');

$request->setRequestUrl('https://sell.app/api/v2/groups/1/products/detach');
$request->setRequestMethod('DELETE');
$request->setBody($body);

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

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

echo $response->getBody();

Response

{
  "detached": [
    1
  ]
}

GET/v2/groups/:id/products

List all products within group

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

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of groups returned

  • Name
    page
    Type
    integer
    Description

    The page number you are attempting to access.

Request

GET
/v2/groups/:id/products
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v2/groups/1/products');
$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": "This will make me rich!",
      "slug": "serial",
      "description": "<p>I am sure of it, Pinky.<\/p>",
      "images": [],
      "order": 1,
      "visibility": "PUBLIC",
      "delivery_text": null,
      "additional_information": [],
      "warranty": {
        "text": "",
        "time": null,
        "preferredUnit": "MINUTES"
      },
      "other_settings": [],
      "deleted_at": null,
      "created_at": "2022-12-12T12:12:12.000000Z",
      "updated_at": "2022-12-12T12:12:12.000000Z",
      "store_id": 1,
      "category_id": null,
      "section_id": null,
      "section_order": null,
      "is_discoverable": 1,
      "pivot": {
        "group_id": 1,
        "listing_id": 1,
        "order": 1
      },
      "default_price": {
        "price": "500",
        "currency": "USD"
      }
    }
  ],
  "links": {
    // ...
  },
  "meta": {
    // ...
  }
}

GET/v2/groups/:id/products/:id

List specific product within group

This endpoint allows you to retrieve a specific product from within a group.

Request

GET
/v2/groups/:id/products/:id
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://sell.app/api/v2/groups/1/products/1');
$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": "This will make me rich!",
    "slug": "serial",
    "description": "<p>I am sure of it, Pinky.<\/p>",
    "images": [],
    "order": 1,
    "visibility": "PUBLIC",
    "delivery_text": null,
    "additional_information": [],
    "warranty": {
      "text": "",
      "time": null,
      "preferredUnit": "MINUTES"
    },
    "other_settings": [],
    "deleted_at": null,
    "created_at": "2022-12-12T12:12:12.000000Z",
    "updated_at": "2022-12-12T12:12:12.000000Z",
    "store_id": 1,
    "category_id": null,
    "section_id": null,
    "section_order": null,
    "is_discoverable": 1,
    "pivot": {
      "group_id": 1,
      "listing_id": 1,
      "order": 1
    }
  }
}