Skip to content

Instantly share code, notes, and snippets.

@stepun
Last active November 21, 2018 15:05
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/82c16b812c224c43a827ff383b090586 to your computer and use it in GitHub Desktop.
Save stepun/82c16b812c224c43a827ff383b090586 to your computer and use it in GitHub Desktop.

API по доступным валютам и странам

Currency by id

Resource URL

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

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

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

Example Request

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

Example Result

{
  "status": "success",
  "data": {
    "model": {
      "id": 1,
      "kg": "643",
      "ng": "Russia",
      "nvg": "Рубль",
      "knvg": "руб",
      "sot": "коп",
      "currency_code": "RUB",
      "kvgm": "643",
      "prno": "0.2",
      "date": null,
      "time": "",
      "c_code": "RU"
    }
  }
}

List currency

Resource URL

https://storencash.com/api/v1_currency.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_currency.json?page=0&count=2 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,
        "kg": "643",
        "ng": "Russia",
        "nvg": "Рубль",
        "knvg": "руб",
        "sot": "коп",
        "currency_code": "RUB",
        "kvgm": "643",
        "prno": "0.2",
        "date": null,
        "time": "",
        "c_code": "RU"
      },
      {
        "id": 2,
        "kg": "112",
        "ng": "Blr",
        "nvg": "Белорусский рубль",
        "knvg": "руб",
        "sot": "коп",
        "currency_code": "BYN",
        "kvgm": "933",
        "prno": "0.2",
        "date": "2016-09-19",
        "time": "08:18:01",
        "c_code": "BY",
        "timestamp": 1474255081
      }
      ],
    "total": 166,
    "count": 2
  }
}

List courses

Resource URL

https://my2can.com/api/v1_course.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_course.json?page=0&count=2 HTTP/1.1
Host: my2can.com
token: 15da7169ee5272b97692ff680cab97f5
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

Example Result

{
  "status": "success",
  "data":{
    "collection":[
    {
      "currency_id": 2,
      "kurs": "1",
      "isDel": 0,
      "date": "2017-05-15",
      "time": "13:24:35",
      "kg": "112",
      "ng": "Belarus",
      "nvg": "Белорусский рубль",
      "knvg": "руб",
      "sot": "коп",
      "currency_code": "BYN",
      "kvgm": "933",
      "prno": "0.2",
      "c_code": "BY",
      "timestamp": 1494836675
    },
    {
      "currency_id": 40,
      "kurs": "1.95",
      "isDel": 0,
      "date": "2017-10-19",
      "time": "16:14:30",
      "kg": "840",
      "ng": "United States",
      "nvg": "Dollar",
      "knvg": "$",
      "sot": "c",
      "currency_code": "USD",
      "kvgm": "840",
      "prno": "0.2",
      "c_code": "US",
      "timestamp": 1508411670
    }
  ],
    "total": 2,
    "count": 2
  }
}

DELETE currency

Уделение валюты. Проверяется наличие валюты в остатках, если все условия выполнены - валюта удаляется, если нет - выдается соответсвующее сообщение.

Resource URL

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

Resource Information

  • Response formats JSON
  • Requires authentication? Yes

Parameters

Name Require Type Description
id yes bigint(10) default = null. Идентификатор удаляемой валюты.

Example Request

DELETE /api/v1_currency.json/101 HTTP/1.1
Host: storencash.com
token: e1ec049b388fbc7f2f9dca44dcbfde06
Cache-Control: no-cache

Example Result

{
    "status": "success",
        "data": {
           "message": "ID:101 deleted"
        }
}

Error codes

Code Description
'15001' Валюты с таким кодом не найдено
'15003' Валюта присутсвует в операциях
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment