Storecards
A service which allows to manage discount cards. All Storecards endpoints have path prefix /storecards-service.
Get countries
Returns a list of countries where a service is available
GET /storecards-service/country
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
Example Response
{
"276": {
"cards_doc_id": "urn:authenticateit:storecards_settings@276",
"country_info": {
"alpha2": "DE",
"alpha3": "DEU",
"iso": "276",
"name": "Germany",
"name_ru": "Германия",
"name_zh": "德国"
}
},
"036": {
"cards_doc_id": "urn:authenticateit:storecards_settings@036",
"country_info": {
"alpha2": "AU",
"alpha3": "AUS",
"iso": "036",
"name": "Australia",
"name_ru": "Австралия",
"name_zh": "澳大利亚"
}
}
}
Set country
Add country to list. Return id of country cards document
POST /storecards-service/country/:id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
id | string | iso code of country, like 036 or 276 |
Example Response
{
"id": "urn:authenticateit:storecards_settings@036"
}
Delete country
Remove country from list.
DELETE /storecards-service/objects/:id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
id | string | iso code of country, like 036 or 276 |
Example Response
{
"result": "ok"
}
Check country
Method that checks service availability in the country.
GET /storecards-service/is_available/:country_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_id | string | iso code of country, like 036 |
Example Response
{
"result": true
}
Get country cards
Returns list of discount cards available for the country.
GET /storecards-service/card/:country_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_id | string | iso code of country, like 036 |
Example Response
[
{
"name": "Test Card",
"image_big": "https://dev-cdn.shping.com/2019/2/6/0092-big.jpg",
"image_small": "https://dev-cdn.shping.com/2019/2/6/0092-small.jpg",
"bgcolor": "#fff",
"id": "3f8488f9-9e7e-4518-9b75-82901783fd2a"
}
]
Set new country card
Create new card for country and return card id.
POST /storecards-service/card/:country_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_id | string | iso code of country, like 036 |
Example body
{
"name": "Test Card",
"image_big": "https://dev-cdn.shping.com/2019/2/6/0092-big.jpg",
"image_small": "https://dev-cdn.shping.com/2019/2/6/0092-small.jpg",
"bgcolor": "#fff"
}
Example Response
{
"id": "3f8488f9-9e7e-4518-9b75-82901783fd2a"
}
Update country card
Update card information.
POST /storecards-service/card/:country_id/:card_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_id | string | iso code of country, like 036 |
card_id | string | 3f8488f9-9e7e-4518-9b75-82901783fd2a |
Example body
{
"name": "Test Card 2",
"image_big": "https://dev-cdn.shping.com/2019/2/6/0092-big.jpg",
"image_small": "https://dev-cdn.shping.com/2019/2/6/0092-small.jpg",
"bgcolor": "#000"
}
Example Response
{
"result": "ok"
}
Delete country card
Delete card from card list.
DELETE /storecards-service/card/:country_id/:card_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_id | string | iso code of country, like 036 |
card_id | string | 3f8488f9-9e7e-4518-9b75-82901783fd2a |
Example Response
{
"result": "ok"
}
Find country cards
Get list of store cards in a country with search option by name.
GET /storecards-service/find_cards/:country_id/:search_string
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_id | string | iso code of country, like 036 |
search_string | string | value for search |
Example Response
[
{
"name": "Updated Test Card",
"image_big": "test_big_image",
"image_small": "test_small_image",
"bgcolor": "#000",
"id": "f661b6d6-664e-4b7d-b438-a0392d128fca"
},
{
"name": "Test Card NEW",
"image_big": "https://dev-cdn.shping.com/2019/2/6/0092-big.jpg",
"image_small": "https://dev-cdn.shping.com/2019/2/6/0092-small.jpg",
"bgcolor": "#fff",
"id": "5c88b863-2247-4e74-be41-300615792132"
}
]
Get card
Get user card list.
GET /storecards-service/user/card
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
Example Response
[
{
"id": "57b6f90e-9c04-4fe3-9346-58d8ac801881",
"custom_fields": [{"id":"cardholder_name","value":"Holder Name"},{"id":"expiry_date","value":"01/01/2020"},{"id":"member_since","value":"member since 3"},{"id":"Notes","value":"Notes text - 12345"}],
"issue_number": "654321",
"country_iso": "036",
"card": {
"name": "Updated Test Card",
"image_big": "test_big_image",
"image_small": "test_small_image",
"bgcolor": "#000",
"id": "799549b8-ac43-4680-9781-192e95bbcfd3"
},
"usage": [
{
"accuracy": "14,4549999237061",
"longitude": "144974757",
"latitude": "-37838094",
"ts": "2019-04-16T09:27:16.716Z"
}
],
"ts": "2019-04-16T09:52:52.436Z"
}
]
Create card
Create new user card.
POST /storecards-service/user/card
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
country_iso | string | iso code of country, like 036 |
country_card_id | string | id of selected country card (guid) |
Example body
{
custom_fields: [{
"id": "cardholder_name",
"value": "Holder Name"
}, {
"id": "expiry_date",
"value": "01/01/2020"
}, {
"id": "member_since",
"value": "member since 3"
}, {
"id": "Notes",
"value": "Notes text"
}
],
"issue_number": "654321",
"country_iso": "036",
"country_card_id": "f661b6d6-664e-4b7d-b438-a0392d128fca"
}
Example Response
{
"id": "1a396b96-e1cc-4438-96b0-5e688155273a"
}
Update card
Update user card information.
POST /storecards-service/user/card/:card_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
card_id | string | user card id (guid) |
Example body
{
custom_fields: [{
"id": "cardholder_name",
"value": "changed - Holder Name"
}, {
"id": "expiry_date",
"value": "01/01/2020"
}, {
"id": "member_since",
"value": "changed - member since 3"
}, {
"id": "Notes",
"value": "changed - Notes text"
}
]
}
Example Response
{
"result": "ok"
}
Delete card
Delete user card.
DELETE /storecards-service/user/card/:card_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
card_id | string | user card id (guid) |
Example Response
{
"result": "ok"
}
Update card usage
Append user card usage information.
POST /storecards-service/user/cardusage/:card_id
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
card_id | string | user card id (guid) |
Example body
{
"accuracy": "14,4549999237061",
"longitude": "144974757",
"latitude": "-37838094"
}
Example Response
{
"result": "ok"
}
Find user card
Looking for user cards that were used in this location earlier.
POST /storecards-service/user/cardusage
Parameters
Name | Type | Description |
---|---|---|
authenticateit_identity_ticket | header | Required: Session's ticket |
Example body
{
"accuracy": "14,4549999237061",
"longitude": "144974757",
"latitude": "-37838094"
}
Example Response
{
"result": {
"issue_number": "987654321",
"custom_fields": [
{
"id": "cardholder_name",
"value": "Тестов Дмитрий Тестович"
},
{
"id": "expiry_date",
"value": "01/01/2021"
},
{
"id": "member_since",
"value": "member since 0507"
},
{
"id": "Notes",
"value": "For test only"
}
],
"country_iso": "643",
"country_card_id": "eeea4263-2180-444e-af8c-1607d11a3b98",
"id": "20973bf4-6cc7-4c18-bbda-129ede8585d8",
"ts": "2019-05-30T07:35:47.326Z",
"usage": [
{
"accuracy": "14,4549999237061",
"longitude": "144974757",
"latitude": "-37838094",
"ts": "2019-05-30T07:41:38.045Z"
}
],
"card": {
"name": "Leroy Merlin",
"bgcolor": "#e04d11",
"image_big": "https://dev-cdn.shping.com/2019/5/15/24dad515-d0d3-4772-9981-e320b1327b09.jpeg",
"image_small": "https://dev-cdn.shping.com/2019/5/15/371dfe75-d1c0-4101-a3c6-80b0076080d2.jpeg",
"id": "eeea4263-2180-444e-af8c-1607d11a3b98"
}
}
}
or for empty
{
"result": null
}