# Open your online storefront

Set the storefront up as a draft — the selling location, a theme, the collections it merchandises, a web address — publish it to go live, moderate the reviews it shows, and take it down when you must without losing the configuration.

Selling · a play in 4 steps.

## The steps

1. Set it up as a draft — nothing is live yet. — [createStorefront](/reference/storefront/createStorefront/)
2. Publish — the configuration is re-checked and the web address claimed. — [publishStorefront](/reference/storefront/publishStorefront/)
3. Approve a customer’s review for display, or reject it — approval publishes their words. — [transitionReview](/reference/review/transitionReview/)
4. Take it down — the address releases; the configuration stands for a republish. — [unpublishStorefront](/reference/storefront/unpublishStorefront/)

## The calls

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

### createStorefront

[createStorefront](/reference/storefront/createStorefront/) — mutation · Set up an online storefront for one of your organizations — pick the selling location, a canned theme, the collections it merchandises, and optionally a browse tree, a channel division and a custom web address.

**Example request**

```graphql
mutation ExampleCreateStorefront($input: NewStorefrontInput!) {
  createStorefront(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    theme
    customDomain
    collectionIds
    categoryId
    divisionId
  }
}
```

Variables:

```json
{
  "input": {
    "caption": "Blue jeans",
    "organizationId": "01900000-0000-7000-8000-44b781470000",
    "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
    "theme": "<theme>"
  }
}
```

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

**Example response**

```json
{
  "data": {
    "createStorefront": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SF-EXMP-0000-000F",
      "type": "Storefront",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "theme": "<theme>",
      "customDomain": "<custom domain>",
      "collectionIds": [
        "01900000-0000-7000-8000-b1c179550000"
      ],
      "categoryId": "01900000-0000-7000-8000-786111a40000",
      "divisionId": "01900000-0000-7000-8000-25bd925b0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### publishStorefront

[publishStorefront](/reference/storefront/publishStorefront/) — mutation · Take a draft storefront live — the whole configuration is re-checked and the custom web address (if set) is claimed.

**Example request**

```graphql
mutation ExamplePublishStorefront($id: ID!, $revision: ID!, $reason: String) {
  publishStorefront(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    theme
    customDomain
    collectionIds
    categoryId
    divisionId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

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

**Example response**

```json
{
  "data": {
    "publishStorefront": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SF-EXMP-0000-000F",
      "type": "Storefront",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "theme": "<theme>",
      "customDomain": "<custom domain>",
      "collectionIds": [
        "01900000-0000-7000-8000-b1c179550000"
      ],
      "categoryId": "01900000-0000-7000-8000-786111a40000",
      "divisionId": "01900000-0000-7000-8000-25bd925b0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### transitionReview

[transitionReview](/reference/review/transitionReview/) — mutation · Moderate a review — approve it for display or reject it.

**Example request**

```graphql
mutation ExampleTransitionReview($id: ID!, $revision: ID!, $op: ReviewTransitionOp!, $reason: String) {
  transitionReview(id: $id, revision: $revision, op: $op, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    authorConsumerId
    targetProductId
    rating
    title
    body
    verifiedPurchase
    verifiedByOrderId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "op": "approve",
  "reason": "Correcting a miscount."
}
```

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

**Example response**

```json
{
  "data": {
    "transitionReview": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RE-EXMP-0000-000F",
      "type": "Review",
      "caption": "Blue jeans",
      "status": "pending",
      "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",
      "authorConsumerId": "01900000-0000-7000-8000-31f6906b0000",
      "targetProductId": "01900000-0000-7000-8000-5fc8acba0000",
      "rating": 1,
      "title": "Blue jeans",
      "body": "Restock before the weekend.",
      "verifiedPurchase": true,
      "verifiedByOrderId": "01900000-0000-7000-8000-f1c470c10000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### unpublishStorefront

[unpublishStorefront](/reference/storefront/unpublishStorefront/) — mutation · Take a live storefront down — the web address is released and the configuration stands for a later republish.

**Example request**

```graphql
mutation ExampleUnpublishStorefront($id: ID!, $revision: ID!, $reason: String) {
  unpublishStorefront(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    theme
    customDomain
    collectionIds
    categoryId
    divisionId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

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

**Example response**

```json
{
  "data": {
    "unpublishStorefront": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SF-EXMP-0000-000F",
      "type": "Storefront",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "theme": "<theme>",
      "customDomain": "<custom domain>",
      "collectionIds": [
        "01900000-0000-7000-8000-b1c179550000"
      ],
      "categoryId": "01900000-0000-7000-8000-786111a40000",
      "divisionId": "01900000-0000-7000-8000-25bd925b0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```
