# sites

Sites - JavaScript client for sites
- [OAuth Scopes](#oauth-scopes) - [Authentication](#authentication) - [Available Endpoints](#available-endpoints) - [Usage Notes](#usage-notes) - [Resources](#resources)  Create and manage sites and routes for headless storefronts.  ## OAuth Scopes | UI Name        | Permission | Parameter               | |----------------|------------|-------------------------| | Sites & Routes | modify     | `store_sites`           | | Sites & Routess| read-only  | `store_sites_read_only` |  For more information on OAuth Scopes, see: [Authentication](https://developer.bigcommerce.com/api-docs/getting-started/authentication).  ## Authentication  Requests can be authenticated by sending a `client_id` and `access_token` via `X-Auth-Client` and `X-Auth-Token` HTTP headers:  ```http GET /stores/{$$.env.store_hash}/v3/catalog/summary host: api.bigcommerce.com Accept: application/json X-Auth-Client: {client_id} X-Auth-Token: {access_token} ```  |Header|Parameter|Description| |-|-|-| |`X-Auth-Client`|`client_id`|Obtained by creating an API account or installing an app in a BigCommerce control panel.| |`X-Auth-Token`|`access_token `|Obtained by creating an API account or installing an app in a BigCommerce control panel.|  For more information on Authenticating BigCommerce APIs, see: [Authentication](https://developer.bigcommerce.com/api-docs/getting-started/authentication).  ## Available Endpoints | Resource / Endpoint                     | Description                                                              | |-----------------------------------------|--------------------------------------------------------------------------| | Channels                                | Create and manage catalog listings and channels                          | | Channel Site                            | Manage sites and routing for headless storefronts                        | | Channel Listings                        | Manage catalog differences among different storefronts or marketplaces   |  ## Usage Notes  **Sites and Site Routes:** * Sites and routes control the paths that make up a headless storefront * Site refers to the domain associated with a channel * Routes point to the URLs for key pages on the headless storefront. They define where the homepage is, where the cart page is, etc. * Sites and routes ensure links point where they’re supposed to and sales are attributed correctly. For example, a shopper’s order confirmation email should link back to Storefront A, where they placed their order, not Storefront B, which they’ve never visited.  ## Resources  ### Related Endpoints * [Channels](https://developer.bigcommerce.com/api-reference/cart-checkout/channels-listings-api)
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 3.0
- Package version: 3.0
- Build package: io.swagger.codegen.v3.generators.javascript.JavaScriptClientCodegen

## Installation

### For [Node.js](https://nodejs.org/)

#### npm

To publish the library as a [npm](https://www.npmjs.com/),
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).

Then install it via:

```shell
npm install sites --save
```

#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:

```shell
    npm install GIT_USER_ID/GIT_REPO_ID --save
```

### For browser

The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
the above steps with Node.js and installing browserify with `npm install -g browserify`,
perform the following (assuming *main.js* is your entry file):

```shell
browserify main.js > bundle.js
```

Then include *bundle.js* in the HTML pages.

### Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error:
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
the following section to your webpack config:

```javascript
module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}
```

## Getting Started

Please follow the [installation](#installation) instruction and execute the following JS code:

```javascript
var Sites = require('sites');
var defaultClient = Sites.ApiClient.instance;

// Configure API key authorization: X-Auth-Client
var X-Auth-Client = defaultClient.authentications['X-Auth-Client'];
X-Auth-Client.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Auth-Client.apiKeyPrefix['X-Auth-Client'] = "Token"

// Configure API key authorization: X-Auth-Token
var X-Auth-Token = defaultClient.authentications['X-Auth-Token'];
X-Auth-Token.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//X-Auth-Token.apiKeyPrefix['X-Auth-Token'] = "Token"

var api = new Sites.SiteRoutesApi()
var siteId = "siteId_example"; // {String} 
var routeId = "routeId_example"; // {String} 

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.deleteRoute(siteId, routeId, callback);
```

## Documentation for API Endpoints

All URIs are relative to *https://api.bigcommerce.com/stores/{$$.env.store_hash}/v3*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*Sites.SiteRoutesApi* | [**deleteRoute**](docs/SiteRoutesApi.md#deleteRoute) | **DELETE** /sites/{site_id}/routes/{route_id} | Delete a Site Route
*Sites.SiteRoutesApi* | [**getSiteRoute**](docs/SiteRoutesApi.md#getSiteRoute) | **GET** /sites/{site_id}/routes/{route_id} | Get a Site Route
*Sites.SiteRoutesApi* | [**indexSiteRoutes**](docs/SiteRoutesApi.md#indexSiteRoutes) | **GET** /sites/{site_id}/routes | Get all Site Routes
*Sites.SiteRoutesApi* | [**postSiteRoute**](docs/SiteRoutesApi.md#postSiteRoute) | **POST** /sites/{site_id}/routes | Create a Site Route
*Sites.SiteRoutesApi* | [**putSiteRoute**](docs/SiteRoutesApi.md#putSiteRoute) | **PUT** /sites/{site_id}/routes/{route_id} | Update a Site Route
*Sites.SiteRoutesApi* | [**sitesSiteIdRoutesPut**](docs/SiteRoutesApi.md#sitesSiteIdRoutesPut) | **PUT** /sites/{site_id}/routes | Update Site Routes
*Sites.SitesApi* | [**deleteSite**](docs/SitesApi.md#deleteSite) | **DELETE** /sites/{site_id} | Delete a Site
*Sites.SitesApi* | [**getSite**](docs/SitesApi.md#getSite) | **GET** /sites/{site_id} | Get a Site
*Sites.SitesApi* | [**postSite**](docs/SitesApi.md#postSite) | **POST** /sites | Create a Site
*Sites.SitesApi* | [**putSite**](docs/SitesApi.md#putSite) | **PUT** /sites/{site_id} | Update a Site
*Sites.SitesApi* | [**sitesGet**](docs/SitesApi.md#sitesGet) | **GET** /sites | Get all Sites

## Documentation for Models

 - [Sites.Body](docs/Body.md)
 - [Sites.Errors](docs/Errors.md)
 - [Sites.InlineResponse200](docs/InlineResponse200.md)
 - [Sites.InlineResponse2001](docs/InlineResponse2001.md)
 - [Sites.InlineResponse422](docs/InlineResponse422.md)
 - [Sites.InlineResponse4221](docs/InlineResponse4221.md)
 - [Sites.LinksFull](docs/LinksFull.md)
 - [Sites.MetaCollection](docs/MetaCollection.md)
 - [Sites.MetaCollectionFull](docs/MetaCollectionFull.md)
 - [Sites.MetaEmpty](docs/MetaEmpty.md)
 - [Sites.Pagination](docs/Pagination.md)
 - [Sites.Pagination1](docs/Pagination1.md)
 - [Sites.Pagination1Links](docs/Pagination1Links.md)
 - [Sites.PaginationFull](docs/PaginationFull.md)
 - [Sites.PostSite](docs/PostSite.md)
 - [Sites.PutSite](docs/PutSite.md)
 - [Sites.PutSite1](docs/PutSite1.md)
 - [Sites.PutSite2](docs/PutSite2.md)
 - [Sites.Route](docs/Route.md)
 - [Sites.Route1](docs/Route1.md)
 - [Sites.Route2](docs/Route2.md)
 - [Sites.Route3](docs/Route3.md)
 - [Sites.Route4](docs/Route4.md)
 - [Sites.Site](docs/Site.md)
 - [Sites.Site1](docs/Site1.md)
 - [Sites.Site2](docs/Site2.md)
 - [Sites.SitesMeta](docs/SitesMeta.md)

## Documentation for Authorization


### X-Auth-Client

- **Type**: API key
- **API key parameter name**: X-Auth-Client
- **Location**: HTTP header

### X-Auth-Token

- **Type**: API key
- **API key parameter name**: X-Auth-Token
- **Location**: HTTP header

