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.

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

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

Variables:

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

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

Example response

{
  "data": {
    "createOptionGroup": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "OP-EXMP-0000-000F",
      "type": "OptionGroup",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "optionGroupType": "color",
      "code": "BJ-001",
      "defaultSizeRunId": "01900000-0000-7000-8000-c20b3cc50000"
    }
  },
  "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

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

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "optionGroupId": "01900000-0000-7000-8000-14f0cf6a0000"
  }
}

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

Example response

{
  "data": {
    "createOptionValue": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "OV-EXMP-0000-000F",
      "type": "OptionValue",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "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

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

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "productId": "01900000-0000-7000-8000-969657010000"
  }
}

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

Example response

{
  "data": {
    "createVariant": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "VR-EXMP-0000-000F",
      "type": "Variant",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "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
        }
      }
    }
  }
}