Channels API

Sylius channels API endpoint is /api/v1/channels.

Index of all channels

To browse all channels available in the Sylius e-commerce platform you can call the following GET request:

GET /api/v1/channels/

Parameters

page
Number of the page, by default = 1
limit
Number of items to display per page

Response

Response will contain a paginated list of channels.

STATUS: 200 OK
{
    "page":1,
    "limit":10,
    "pages":1,
    "total":3,
    "_links":{
        "self":{
            "href":"\/api\/channels\/?page=1"
        },
        "first":{
            "href":"\/api\/channels\/?page=1"
        },
        "last":{
            "href":"\/api\/channels\/?page=12"
        },
        "next":{
            "href":"\/api\/channels\/?page=2"
        }
    },
    "_embedded":{
        "items":[
            {
                "code": "WEB-UK",
                "color": "Red",
                "created_at": "2014-11-26T23:00:15+0000",
                "currencies": [
                ],
                "enabled": true,
                "id": 91,
                "locales": [
                ],
                "name": "UK Webstore",
                "payment_methods": [
                ],
                "shipping_methods": [
                ],
                "type": "web",
                "updated_at": "2014-11-26T23:00:15+0000"
            }
        ]
    }
}

Getting a single channel

You can view a single channel by executing the following request:

GET /api/v1/channels/91

Response

STATUS: 200 OK
{
    "code": "WEB-UK",
    "color": "Red",
    "created_at": "2014-11-26T23:00:15+0000",
    "currencies": [
    ],
    "enabled": true,
    "id": 91,
    "locales": [
    ],
    "name": "UK Webstore",
    "payment_methods": [
    ],
    "shipping_methods": [
    ],
    "type": "web",
    "updated_at": "2014-11-26T23:00:15+0000"
}

Creating a channel

To create a new channel, you can execute the following request:

POST /api/v1/channels/

Parameters

code
Unique code
color
Color used in the backend
enabled (optional)
Is enabled? (boolean)
locales (optional)
Array of Locale id
currencies (optional)
Array of Currency id
payment_methods (optional)
Array of PaymentMethod id
shipping_methods (optional)
Array of ShippingMethod id

Response

STATUS: 201 CREATED
{
    "code": "WEB-US",
    "color": "Blue",
    "created_at": "2014-11-26T23:00:15+0000",
    "currencies": [
    ],
    "enabled": true,
    "id": 92,
    "locales": [
    ],
    "name": "US Webstore",
    "payment_methods": [
    ],
    "shipping_methods": [
    ],
    "type": "web",
    "updated_at": "2014-11-26T23:00:15+0000"
}

Updating a channel

You can update an existing channel using PUT or PATCH method:

PUT /api/v1/channels/92
PATCH /api/v1/channels/92

Parameters

code
Unique code
color
Color used in the backend
enabled (optional)
Is enabled? (boolean)
locales (optional)
Array of Locale id
currencies (optional)
Array of Currency id
payment_methods (optional)
Array of PaymentMethod id
shipping_methods (optional)
Array of ShippingMethod id

Response

STATUS: 204 NO CONTENT

Deleting a channel

You can delete (soft) a channel from the system by making the following DELETE call:

DELETE /api/v1/channels/92

Response

STATUS: 204 NO CONTENT