Skip to content

Instantly share code, notes, and snippets.

@stepun
Last active November 21, 2018 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stepun/f4806e451c38c9d79c71 to your computer and use it in GitHub Desktop.
Save stepun/f4806e451c38c9d79c71 to your computer and use it in GitHub Desktop.

API Orders

Order by id

Resource URL

https://storencash.com/api/v1_orders.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) identifier product. Primary key.

Example Request

GET /api/v1_orders.json/1 HTTP/1.1
Host: storencash.com
token: e1ec049b388fbc7f2f9dca44dcbfde06
Cache-Control: no-cache

Example Result

{
  "status": "success",
  "data": {
    "model": {
      "id": 1,
      "date": "2017-05-30",
      "time": "16:10:39",
      "datep": "0000-00-00",
      "timep": "",
      "datef": "0000-00-00 00:00:00",
      "store_id": 1,
      "sabor_id": 6,
      "msut_id": 5,
      "susers_id": 1,
      "description": "123",
      "isDel": 0,
      "document_date": "2017-05-30",
      "document_number": "5",
      "mzs_id": 1,
      "payment": "0",
      "address": "Адрес доставки",
      "is_payment": "0",
      "is_shipped": "0",
      "type": "1",
      "timestamp": 1496142639
    },
    "products": {
      "list": [
        {
          "mz_id": "1",
          "mz_type": "1",
          "id": 7,
          "remains_id": 6,
          "msut_id": 5,
          "operation_id": 10,
          "document_number": "5",
          "document_date": "2017-05-30",
          "store_id": 1,
          "product_id": 38,
          "container": "ac57f8d703a5925511a6e64e9caacfad",
          "price_p": 15,
          "price": 24,
          "currency_id": 2,
          "sgo_oid": 2,
          "kurs": "1",
          "okurs": "1",
          "measureId": 101,
          "date": "2017-05-30",
          "time": "16:10:39",
          "count": 1,
          "remains_barcode": "1300000000383",
          "name": "test22",
          "vendor": "",
          "sku": "",
          "barcode": "1300000000383",
          "type": "1",
          "measure_full_name": "ШТУКА",
          "measure_name": "ШТ",
          "currency_code": "BYN",
          "knmo": "BYN",
          "timestamp": 1496142639
         }
      ],
      "listMsusw": [
        {
          "id": 1477,
          "remains_id": 1181,
          "group_id": 13,
          "value_id": 13,
          "level_id": 3,
          "cont_naim": "Размер XS",
          "value": "XS",
          "name": "Размер"
        },
        {
          "id": 1655,
          "remains_id": 1357,
          "group_id": 14,
          "value_id": 14,
          "level_id": 3,
          "cont_naim": "Размер S",
          "value": "S",
          "name": "Размер"
        },
        {
          "id": 1656,
          "remains_id": 1358,
          "group_id": 15,
          "value_id": 15,
          "level_id": 3,
          "cont_naim": "Размер M",
          "value": "M",
          "name": "Размер"
        },
        {
          "id": 1657,
          "remains_id": 1359,
          "group_id": 16,
          "value_id": 16,
          "level_id": 3,
          "cont_naim": "Размер L",
          "value": "L",
          "name": "Размер"
        }
      ],
      "total": 4
    },
    "goods": {
      "list": [      
      ],
      "listMsusw": [
        {
          "id": 1477,
          "remains_id": 1181,
          "group_id": 13,
          "value_id": 13,
          "level_id": 3,
          "cont_naim": "Размер XS",
          "value": "XS",
          "name": "Размер"
        },
        {
          "id": 1478,
          "remains_id": 1182,
          "group_id": 14,
          "value_id": 14,
          "level_id": 3,
          "cont_naim": "Размер S",
          "value": "S",
          "name": "Размер"
        },
        {
          "id": 1479,
          "remains_id": 1183,
          "group_id": 15,
          "value_id": 15,
          "level_id": 3,
          "cont_naim": "Размер M",
          "value": "M",
          "name": "Размер"
        },
        {
          "id": 1480,
          "remains_id": 1184,
          "group_id": 16,
          "value_id": 16,
          "level_id": 3,
          "cont_naim": "Размер L",
          "value": "L",
          "name": "Размер"
        }
      ],
      "listMsusp":[
        {
          "id": 1,
          "remains_id": 5,
          "spar_id": 5,
          "parc": "красный",
          "parm": "",
          "date": "2017-05-25",
          "time": "13:05:20",
          "container": "53c2c163c9f051b6bb025edc746a060e",
          "name": "Цвет",
          "alias": "COLOR",
          "spart_id": 1,
          "type_name": "EDIT",
          "type": "C",
          "mask": "xxxxxx",
          "timestamp": 1495699520
        }
      ],
      "total": 4
    },
    "statuses": [
      {
        "id": 1,
        "name": "новый",
        "is_del": 0,
        "color": "#f21457"
      },
      {
        "id": 2,
        "name": "в обработке",
        "is_del": 0,
        "color": "#008000"
      },
      {
        "id": 3,
        "name": "собран",
        "is_del": 0,
        "color": "#1E90FF"
      },
      {
        "id": 4,
        "name": "отправлен",
        "is_del": 0,
        "color": "#4B0082"
      },
      {
        "id": 5,
        "name": "закрыт",
        "is_del": 0,
        "color": "#87CEFA"
      },
      {
        "id": 6,
        "name": "отменен",
        "is_del": 0,
        "color": "#A9A9A9"
      }
    ]
  }
}

List orders

Resource URL

https://storencash.com/api/v1_orders.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
timestamp no int(11) default = 0. Получить данные с данной даты (Time Stamp формат - количество миллисекунд с 1 января 1970 года. Необходим для получения обновленных данных).
page no int(10) default = 0. Page.
count no int(10) default = 1000. Count models in page. Limit max 1000 models in one request!

Example Request

GET /api/v1_orders.json?page=0&count=5&timestamp=1474277290 HTTP/1.1
Host: storencash.com
token: 15da7169ee5272b97692ff680cab97f5
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

Example Result

{
  "status": "success",
  "data":{
    "collection":[
  {
    "id": 1,
    "date": "2017-05-30",
    "time": "16:10:39",
    "datep": "0000-00-00",
    "timep": "",
    "datef": "0000-00-00 00:00:00",
    "store_id": 1,
    "sabor_id": 6,
    "msut_id": 5,
    "susers_id": 1,
    "description": "123",
    "isDel": 0,
    "document_date": "2017-05-30",
    "document_number": "5",
    "mzs_id": 1,
    "payment": "0",
    "address": "Адрес доставки",
    "is_payment": "0",
    "is_shipped": "0",
    "type": "1",
    "client_name": "Петя",
    "company_address": "Петин адрес доставки",
    "phone": "123",
    "fax": "",
    "status": "новый",
    "color": "#ebd45f",
    "login": "test00@gmail.com",
    "username": "test00",
    "operation_id": 10,
    "timestamp": 1496142639
  },
  {
    "id": 2,
    "date": "2017-05-30",
    "time": "16:13:49",
    "datep": "0000-00-00",
    "timep": "",
    "datef": "0000-00-00 00:00:00",
    "store_id": 1,
    "sabor_id": 6,
    "msut_id": 9,
    "susers_id": 1,
    "description": "",
    "isDel": 0,
    "document_date": "2017-05-30",
    "document_number": "7",
    "mzs_id": 1,
    "payment": "0",
    "address": "Петин адрес доставки",
    "is_payment": "0",
    "is_shipped": "0",
    "type": "1",
    "client_name": "Петя",
    "company_address": "Петин адрес доставки",
    "phone": "123",
    "fax": "",
    "status": "новый",
    "color": "#ebd45f",
    "login": "test00@gmail.com",
    "username": "test00",
    "operation_id": 10,
    "timestamp": 1496142829
  }
  ],
    "total": 2,
    "count": 2
  },
  "base_id": 3
}

Add order

Resource URL

https://storencash.com/api/v1_orders.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
autoprihod no int(10) default = 1. Признак автоматического оприходования (0 - без автоприхода, 1 - автоприход включен) на склад, т.е. в случае если операция расхода, и данного товара нет на складе, будет произведен автоматичсекий приход (автоприход) на склад а затем списание.
db_id no int(10) default = 0. Идентификатор контрагента или склада (зависит от операции, для оформления заказа это идентификатор контрагента на которого делаем заказ)
mz_id no int(10) default = 0. Идентификатор заказа. Если = 0 то добавление нового заказа, если не равен 0 то изменение.
sabor_kid no int(10) default = 0. Идентификатор контрагента.
contractor no array default = null. Массив значений полей контрагента {"external_id": "123", "company_name": "Test"} более подробно о списке полей смотрите API company.
payment_document no array default = null. Массив значений полей платежного документа {"document_number": "55В-22", "ddok": "2017-01-19", "sumv": 50}.
descr no text default = null. Коментарий заказа.
address no text default = null. Адрес доставки.
device_id no varchar(100) default = null. default - null Уникальный идентификатор устройства (касса, терминал и тд).
sabor_rid no int(10) default = 1. Идентификатор резидента (по-умолчанию идентификатор вашей организации из справочника организаций).
storage_id yes int(10) default - 0. Идентификатор склада (магазина), на который (с которого) делает приход (расход).
operation_id no int(10) default - 10. Идентификатор операции. (по умолчанию идентификатор операции заказа = 10)
svop_pu no int(10) default - 1. Признак операции (1 - приход, 2 - расход. Для оформления заказа признак должен быть = 1)
svop_pvp no int(10) default - 1. Признак мультиопераций (Для оформления заказа признак должен быть = 1)
goods yes array default - null. Массив товар, входящих в заказ.

Goods parameters

Name Require Type Description
mz_id yes int(10) default - 0. Идентификатор заказа. Если = 0 то добавление нового заказа, если не равен 0 то изменение.
document_number no varchar(50) default - 0. Номер документа. По-умолчанию равен идентификатору транзакции.
document_date no date default - now. Дата документа
sabor_kid no int(10) default - 0. Идентификатор контрагента товара.
product_id yes int(10) default - 0.
measureId no int(10) default - 0.
price yes double default - 0. Цена продажи.
count yes double default - 0. Количество.
🆕currency_id no int default - национальная валюта. Валюта заказа (по умолчанию устанавливается валюта организации)

Update status order

Resource URL

https://storencash.com/api/v1_orders.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) default = null. identifier order. Primary key.
mzs_id yes int(10) default = null. Status order identifier.

Example Request

PUT /api/v1_orders.json/22 HTTP/1.1
Host: storencash.com
token: 61e76bf664a0597144194eeee660cdc9
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

mzs_id=3

Example Result

{
  "status": "success",
  "data": {
    "id": 22
  }
}

Update description order

Resource URL

https://storencash.com/api/v1_orders.json

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes int(10) default = null. identifier order. Primary key.
action no varchar(50) default = null. setBidDescr for action set order description.
descr no text default = null. Description

Example Request

PUT /api/v1_orders.json/22 HTTP/1.1
Host: storencash.com
token: 61e76bf664a0597144194eeee660cdc9
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

action=setBidDescr&descr=test

Example Result

{
  "status": "success",
  "data": {
    "id": 22
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment