AlmondTill/G3N API

Describe how products vary — sizes, colours, options

Say what dimensions your products vary by, list the values, then add the exact sellable variants — the barcode level — under each product.

Catalog · a play in 3 steps.

In the office

Where it starts: the office’s Option groups page.

Step 1. Add the dimension — Size, Colour, Material. Open Option groups.

Step 2. List the values inside it — Large, Red, Cotton. Open Option values.

Step 3. Add the exact sellable variant under the product — the thing a barcode names. Open Variants.

For developers — the calls

The steps

  1. Add the dimension — Size, Colour, Material. — createOptionGroup
  2. List the values inside it — Large, Red, Cotton. — createOptionValue
  3. Add the exact sellable variant under the product — the thing a barcode names. — createVariant

The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

createOptionGroup

createOptionGroup — mutation · Create a new option group — a dimension like Size or Colour that variants vary by at your organization.

Example request

graphql
mutation ExampleCreateOptionGroup($input: NewOptionGroupInput!) {
  createOptionGroup(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    optionGroupType
    code
    defaultSizeRunId
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "optionGroupType": "color"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "createOptionGroup": {
      "id": "01900000-0000-7000-8000-1b25d4e70000",
      "sysId": "OP-EXMP-0000-000F",
      "type": "OptionGroup",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "optionGroupType": "color",
      "code": "BJ-001",
      "defaultSizeRunId": "01900000-0000-7000-8000-7470d3980000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

createOptionValue

createOptionValue — mutation · Create a new one value inside an option group (like “Large” or “Red”) at your organization.

Example request

graphql
mutation ExampleCreateOptionValue($input: NewOptionValueInput!) {
  createOptionValue(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    ordinal
    code
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "optionGroupId": "01900000-0000-7000-8000-1b25d4e70000"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "createOptionValue": {
      "id": "01900000-0000-7000-8000-011d2fcd0000",
      "sysId": "OV-EXMP-0000-000F",
      "type": "OptionValue",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-1b25d4e70000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "ordinal": 1,
      "code": "BJ-001"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

createVariant

createVariant — mutation · Create a new variant — the exact sellable thing (the barcode level) at your organization.

Example request

graphql
mutation ExampleCreateVariant($input: NewVariantInput!) {
  createVariant(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    stockUomKind
    stockUomRef
    code
  }
}

Variables:

json
{
  "input": {
    "caption": "Blue jeans",
    "productId": "01900000-0000-7000-8000-529c60cc0000"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

json
{
  "data": {
    "createVariant": {
      "id": "01900000-0000-7000-8000-8433b0260000",
      "sysId": "VR-EXMP-0000-000F",
      "type": "Variant",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-529c60cc0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 0,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "stockUomKind": "canned",
      "stockUomRef": "<stock uom ref>",
      "code": "BJ-001"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}