Promotion

Contain data reffered to promotions.


Receive a list of all Promotions

Query parameters:
  • fields - list of fields returning in response
  • limit - number of returned pages (default: 50)
  • page - currently displayed page (default: 1)
  • promotion_type - filter with promotion_type (1 - price, 2 - percentage)
  • start_at - Shows promotions, which starting date was later than specified (format: 2011-06-19 13:18:50)
  • finish_at - Shows promotions, which starting date was earlier than specified (format: 2011-06-19 13:18:50)
GET /services/promotions

Returns all promotions

HTTP/1.1 200 OK
                        {
                        "promotions": [
                        {
                        "id" : 1,
                        "title" : "Special offer",
                        "start_at" : "2014-11-01 00:00:00",
                        "finish_at" : "2014-11-05 00:00:00",
                        "promotion_type" : 1,
                        "promotion_value" : 5000,
                        "promotion_on_type" : 1,
                        "promotion_on_value" : [
                            1,
                            2
                        ],
                        "activate" : 2,
                        "created_at" : "2011-09-22 01:15:35",
                        },
                        {
                        "id" : 2,
                        "title" : "Winter sale",
                        "start_at" : "2014-12-01 00:00:00",
                        "finish_at" : "2014-12-30 00:00:00",
                        "promotion_type" : 2,
                        "promotion_value" : 25,
                        "promotion_on_type" : 1,
                        "promotion_on_value" : [
                            1,
                            2
                        ],
                        "activate" : 2,
                        "created_at" : "2011-09-22 01:15:35",
                        }
                        ]
                        }

Receive a count of all Promotions

Query parameters:
  • fields - list of fields returning in response
  • limit - number of returned pages (default: 50)
  • page - currently displayed page (default: 1)
  • promotion_type - filter with promotion_type (1 - price, 2 - percentage)
  • start_at - Counts promotions, which starting date was later than specified (format: 2011-06-19 13:18:50)
  • finish_at - Counts promotions, which starting date was earlier than specified (format: 2011-06-19 13:18:50)
GET /services/promotions/count

Receive a count of all promotions

HTTP/1.1 200 OK
                        {
                        "count": 2
                        }

Receive a single Promotion

Query parameters:
  • fields - list of fields returning in response
GET services/promotions/{id}

Receive a single Promotion

Response
HTTP/1.1 200 OK
                        {
                        "id" : 2,
                        "title" : "Winter sale",
                        "start_at" : "2014-12-01 00:00:00",
                        "finish_at" : "2014-12-30 00:00:00",
                        "promotion_type" : 2,
                        "promotion_value" : 25,
                        "promotion_on_type" : 1,
                        "promotion_on_value" : [
                        1,
                        2
                        ],
                        "activate" : 2,
                        "created_at" : "2011-09-22 01:15:35",
                        }
                        ]
                        }

Create a Promotion

Accepted parameters:
  • promotion_type - 1 - price, 2 - percentage
  • promotion_on_type - 1 - promotion on product, 2 - promotion on category, 3 - promotion on collection, 4 - promotion on specified vendor
  • promotion_on_value - IDs of objects specified with "promotion_on_type"
  • products - Array of Product IDs (if product_on_type is equal 1)
  • promotion_set - related object ID (if promotion_on_type is not equal 1)
POST services/promotions

Create promotion with specified parameters

Request
{
                        "promotion": {
                            "title" : "Winter sale",
                            "start_at" : "2014-12-01 00:00:00",
                            "finish_at" : "2014-12-30 00:00:00",
                            "promotion_type" : 2,
                            "promotion_on_type" : 1,
                            "promotion_value" : 25,
                            "products" : [
                                1,
                                2
                            ]
                        }
}
Response
HTTP/1.1 200 OK
                        {
                        "promotion" : {
                            "id" : 2,
                            "title" : "Winter sale",
                            "start_at" : "2014-12-01 00:00:00",
                            "finish_at" : "2014-12-30 00:00:00",
                            "promotion_type" : 2,
                            "promotion_value" : 25,
                            "promotion_on_type" : 1,
                            "promotion_on_value" : [
                            1,
                            2
                            ],
                            "activate" : 2,
                            "created_at" : "2011-09-22 01:15:35",
                            }
                            ]
                        }
                    }

Update an existing Promotion

PUT services/promotions/{id}

You can update a given promotion

Request
{
                        "promotion": {
                            "start_at" : "2015-01-01 00:00:00",
                            "finish_at" : "2015-02-30 00:00:00",
                            "promotion_type" : 2,
                            "promotion_value" : 25
                        }
                        }
Response
HTTP/1.1 200 OK
                        {
                        "id"	: 2,
                        }

Delete an existing Promotion

DELETE services/promotions/{id}

Delete an existing promotion from a shop

Response
HTTP/1.1 200 OK
                        {
                        "status"	: "ok",
                        }