PHPackages                             concretecms-community-store/community\_store\_api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. concretecms-community-store/community\_store\_api

ActiveConcrete5-package[API Development](/categories/api)

concretecms-community-store/community\_store\_api
=================================================

Provides a RESTful API for ConcreteCMS Community Store

v1.0.4(2y ago)2342MITPHP

Since Dec 30Pushed 2y ago2 watchersCompare

[ Source](https://github.com/concretecms-community-store/community_store_api)[ Packagist](https://packagist.org/packages/concretecms-community-store/community_store_api)[ Docs](https://github.com/concretecms-community-store/community_store_api)[ RSS](/packages/concretecms-community-store-community-store-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)DependenciesVersions (3)Used By (0)

Community Store API
===================

[](#community-store-api)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A Concrete CMS add-on that provides a RESTful API for Community Store data, returning and receiving JSON data.

Current Functionality
---------------------

[](#current-functionality)

- Fetch lists of orders and individual order details
- Update the fulfilment status of orders
- Fetch lists of products and individual products
- Update product and variation stock levels by product ID or by SKU
- Fetch fulfilment statuses

This functionality may be expanded in the future.

Setup
-----

[](#setup)

Once installed, the Community Store API is accessed through concrete5's built-in API, which uses **OAuth2** for authentication. To configure an integration:

- Visit in the concrete5 dashboard, **System &amp; Settings -&gt; API**
- Enable the API via the checkbox if not already enabled, and ensure the **Client Credentials** option is checked under the **Enabled Grant Types**
- Add an Integration via the **Add Integration** button
- Give the integration a name appropriate for the purpose, i.e. 'Community Store API'
- Record the *Client ID* and *Client Secret* values generated

Missing Authorization Header
----------------------------

[](#missing-authorization-header)

When running concrete5 with Apache with CGI/FastCGI, Authorization headers may not be passed to PHP, resulting in a 'Missing Authorization header' error message. Adding the following line to an .htaccess file can correct this:

`SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0`

Usage with PHP
--------------

[](#usage-with-php)

If you need to access the Community Store API via PHP, you may find useful [this project](https://github.com/concretecms-community-store/community_store_api_client).

General Usage
-------------

[](#general-usage)

Once an integration has been created through concrete5's dashboard, the Client ID and Client Secret can be used to generate access tokens, and those are then used to access the API.

Request access tokens by sending a POST request to the URL: `/oauth/2.0/token`, sending in the body:

- grant\_type: "client\_credentials"
- scope: "cs:orders:read cs:products:write cs:products:read cs:products:write cs:config:read"
- client\_id
- client\_secret

The scopes passed can be reduced down to only those needed for the integration.

A JSON response will contain an `access_token` value. The access token typically lasts for 1 hour.

The access token can then be used when performing requests against the API, being sent as an authorization header. The authorization header needs to be prefixed with 'Bearer '.

Responses follow typical RESTful style HTTP response codes, such as 404 for not found records, 200 for found records, etc, along with error messages.

### Order related endpoints:

[](#order-related-endpoints)

#### GET /cs/api/v1/orders

[](#get-csapiv1orders)

Get paginated orders

- scope required: cs:orders:read
- example response:

```
{
    "data": [
        {
            "id": 3,
            "date_placed": {
                "date": "2020-10-06 12:12:37.000000",
                "timezone": "America/Phoenix"
            },
            "total": 100.50,
            "payment_method": "Invoice",
            "payment_date": null,
            "payment_reference": null,
            "shipping_method": "",
            "fulfilment": {
                "status": "Delivered",
                "handle": "Delivered",
                "tracking_id": '123',
                "tracking_code": 'ABC1234',
                "tracking_url": null
            },
            "locale": "en_US",
            "customer": {
                "email": "test@test.com,
                "username": null,
                "billing": {
                    "phone": "123123123",
                    "first_name": "Joe",
                    "last_name": "Smith",
                    "company": "ABC Company",
                    "address": {
                        "address1": "123 Street",
                        "address2": "",
                        "address3": null,
                        "city": "Phoenix",
                        "state_province": "AZ",
                        "country": "US",
                        "postal_code": "55555"
                    }
                },
                "shipping": {
                    "first_name": "Joe",
                    "last_name": "Smith",
                    "company": "ABC Company",
                    "address": {
                          "address1": "123 Street",
                          "address2": "",
                          "address3": null,
                          "city": "Phoenix",
                          "state_province": "AZ",
                          "country": "US",
                          "postal_code": "55555"
                      }
                }
            },
            "items": [
                {
                    "id": 123,
                    "name": "Example Product",
                    "sku": "ABCD",
                    "quantity": 1,
                    "price": 100.50
                }
            ]
        }

        // ... addition 19 orders would be included here

    ],
    "meta": {
        "pagination": {
            "total": 25,
            "count": 20,
            "per_page": 20,
            "current_page": 1,
            "total_pages": 2,
            "links": {
                "next": "http://concrete5.test/cs/api/v1/orders?page=2"
            }
        }
    }
}

```

##### Paginating Orders

[](#paginating-orders)

Orders are returned with the most recent orders first, which is the same as the order ID in descending order.

The orders are paginated, returning 20 orders at a time. Note in the response there is a `meta` -&gt; `pagination` section, containing values representing the pagination position. The `links` within the pagination data include when applicable previous and next URLs, to navigate the pages of orders. No more pages are available when the `next` value is not returned. The GET attribute `page` is used in the API call to select which page to return.

##### Filtering orders

[](#filtering-orders)

You can use querystring parameters to filter the results. Here's a list of accepted querystring parameters:

- `status`: the status of the orders (predefined statuses are `incomplete`, `processing`, `shipped`, `delivered`, `nodelivery`, and `returned`)
- `paymentStatus`: the status of the order payments (`paid`, `unpaid`, `cancelled`, `refunded`, or `incomplete`)
- `fromDate`: the initial date of the orders (format: YYYY-MM-DD)
- `toDate`: the final date of the orders (format: YYYY-MM-DD)
- `paid`: set to 0 for unpaid or refunded orders, 1 for paid and not refunded orders
- `cancelled`: set to 0 to exclude cancelled orders, 1 to retrieve only cancelled orders
- `refunded`: set to 0 to exclude refunded orders, 1 to retrieve only refunded orders
- `shippable`: set to 0 to exclude shippable orders, 1 to retrieve only shippable orders
- `id`: the order ID. You can also query for more IDs using an array (for example: `orders?id[]=1&id[]=2`) (requires Community Store with [this pull request](https://github.com/concretecms-community-store/community_store/pull/833))

#### GET /cs/api/v1/orders/oID

[](#get-csapiv1ordersoid)

Get an order

- scope required: cs:orders:read
- url parameters: oID = Order ID
- response: JSON representing individual order, within `data` value

#### PATCH /cs/api/v1/orders/oID

[](#patch-csapiv1ordersoid)

Update fulfilment details of an an individual order

- scope required: 'cs:orders:write
- updatable fields: tracking\_id, tracking\_code, tracking\_url, handle
- raw body expected: JSON data, e.g.:

```
{
"data":
  {
      "fulfilment": {
          "handle": "shipped",
          "tracking_id": "123123123",
          "tracking_code": "AAABBCCC",
          "tracking_url": "https://trackmyparcel.com"
      }
  }
}

```

- response: JSON representing individual order, within `data` value, after update performed

#### GET /cs/api/v1/fulfilmentstatuses

[](#get-csapiv1fulfilmentstatuses)

Get all fulfilment statuses

- scope required: cs:orders:read
- example response:

```
{
    "data": [
        {
            "id": "1",
            "handle": "incomplete",
            "name": "Awaiting Processing"
        },
        {
            "id": "2",
            "handle": "processing",
            "name": "Processing"
        },
        {
            "id": "3",
            "handle": "shipped",
            "name": "Shipped"
        },
        {
            "id": "4",
            "handle": "delivered",
            "name": "Delivered"
        },
        {
            "id": "5",
            "handle": "nodelivery",
            "name": "Will not deliver"
        },
        {
            "id": "6",
            "handle": "returned",
            "name": "Returned"
        }
    ]
}

```

### Product related endpoints:

[](#product-related-endpoints)

#### GET /cs/api/v1/products

[](#get-csapiv1products)

Get all products

- scope required: cs:products:read
- response: JSON array of products, within `data` value

##### Paginating Products

[](#paginating-products)

Products are returned with the most recently added products first.

The products are paginated, returning 20 products at a time. Note in the response there is a `meta` -&gt; `pagination` section, containing values representing the pagination position. The `links` within the pagination data include when applicable previous and next URLs, to navigate the pages of products. No more pages are available when the `next` value is not returned. The GET attribute `page` is used in the API call to select which page to return.

##### Filtering Products

[](#filtering-products)

Products can be filtered through the use of a `filter` parameter, following the pattern: `?filter=date_added gt '2021-01-01T20:00'`Currently, `date_added` and `date_updated` fields can be filtered, with gt, lt and eq comparisons.

#### GET /cs/api/v1/products/pID

[](#get-csapiv1productspid)

Get a product

- scope required: cs:products:read
- url parameters: pID = Product ID
- response: JSON representing individual product, within `data` value
- example response:

```
{
    "data": {
        "id": 123,
        "name": "Example Product",
        "sku": "ABCD",
        "barcode": "",
        "active": true,
        "stock_unlimited": false,
        "stock_level": 10,
        "short_description": "Short description HTML",
        "description": "Extended description HTML",
        "brand": null,
        "price": 100.50,
        "primary_image": "https://domain.com/product.jpg",
        "additional_images": [
            "https://domain.com/product2.jpg"
        ],
        "groups": [
            "Product Group 1"
        ],
        "categories": [
            {
                "name": "Product Category 1",
                "url": "https://domain.com/category1"
            }
        ],
        "variations": [],
        "date_added": {
            "date": "2020-10-05 15:41:00.000000",
            "timezone": "America/Phoenix"
        },
       "date_updated": {
            "date": "2020-10-05 15:41:00.000000",
            "timezone": "America/Phoenix"
        }
    }
}

```

#### PATCH /cs/api/v1/products/pID

[](#patch-csapiv1productspid)

Update a product

- updatable fields: stock\_unlimited (boolean), stock\_level (float)
- scope required: cs:products:write
- url parameters: pID = Product ID
- raw body expected: JSON data, e.g.:

```
{
  "data":
    {
        "stock_level": 5,
        "stock_unlimited": true
    }
}

```

- response: JSON representing individual product, within `data` value, after update performed

#### GET /cs/api/v1/skus/sku

[](#get-csapiv1skussku)

Get stock level of a product or variation, found via SKU

- scope required: cs:products:read
- url parameters: sku = Product or Variation SKU

#### PATCH /cs/api/v1/skus/sku

[](#patch-csapiv1skussku)

Update the stock level of a product or variation by SKU

- updatable fields: stock\_unlimited (boolean), stock\_level (float)
- scope required: cs:products:write
- url parameters: sku = Product or Variation SKU
- raw body expected: JSON data, e.g.:

```
{
"data":
    {
        "stock_level": 5,
        "stock_unlimited": true
    }
}

```

### Miscellaneous endpoints

[](#miscellaneous-endpoints)

#### GET /cs/api/v1/config

[](#get-csapiv1config)

Get some Comminity Store configuration value

- scope required: cs:config:read
- response: JSON object whose keys are the configuration keys, and values are their values
- example response: ```
    {
        "currency": {
            "code": "EUR",
            "symbol": "€",
            "decimal_digits": 2
        }
    }
    ```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~25 days

Total

2

Last Release

892d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e9d7ece045fc89575e083ee4852edf31218df403c84f41a0de01863dae982f5?d=identicon)[mlocati](/maintainers/mlocati)

![](https://www.gravatar.com/avatar/e535a56a22133af1f2a459534bfdddc57863a5df0d5fd833374eceff563ac2e2?d=identicon)[Mesuva](/maintainers/Mesuva)

---

Top Contributors

[![Mesuva](https://avatars.githubusercontent.com/u/1079600?v=4)](https://github.com/Mesuva "Mesuva (27 commits)")[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (12 commits)")[![ebmudremyc](https://avatars.githubusercontent.com/u/25369541?v=4)](https://github.com/ebmudremyc "ebmudremyc (1 commits)")

---

Tags

concrete5ecommerce

### Embed Badge

![Health badge](/badges/concretecms-community-store-community-store-api/health.svg)

```
[![Health](https://phpackages.com/badges/concretecms-community-store-community-store-api/health.svg)](https://phpackages.com/packages/concretecms-community-store-community-store-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
