Cards

The Customer can be identified by different unique identificators - cards related to the account. Credit Card, Loyalty Card, mobile Card, skipass, virtual Card or any other type of unique personal ID or any other identification method like barcode, QR code or any other key can be used. All the unique customer cards (identificators) related to the Customer account can be processed by this resource.

Available methods

All available methods for resource cards.

HTTP method Endpoint Description
[badge-green POST] /cards Create a new card
[badge-blue GET] /cards Get information about all cards
[badge-blue GET] /cards/{card_id} Get information about a specific card
[badge-grey PUT] /cards/{card_id} Update a specific card

Actions

Action methods for resource cards.

HTTP method Endpoint Description
[badge-green POST] /cards/actions/assign-free-card Action method assign free card in order to customer.
[badge-green POST] /cards/actions/generate-digital-card-file Action method generates file with digital card.


Create a card

Add a new customer card
[badge-green POST] /cards

Request

Parameter name Type Description Mandatory (Yes/No)
card Card Card resource Yes

Response

Status code: 201 Created
Output structure : object

Parameter name Type Description
card_id string The unique id for the card

Example request

POST <projectURL>/rest-api/customer-interface/v1.0/cards
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

{
    "card": {
        "card_type_id": "189dd18cff7a4b1a1erd19bcfcf9a9964e2e9f3d7f9d43e967e",
        "card_number": "2001995001037",
        "state":1
  }
}

Example response

HTTP/1.1 201 Created
Date: Mon, 22 Jul 2019 12:23:01 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "card_id": "189dd18cff7a4b1a1a6d19bcfcf9a9964e2e9f3d7f9d43e967e"
  }
}


Get all cards

Get information about all customer cards
[badge-blue GET] /cards

Query string

Parameter name Type Description Mandatory (Yes/No)
count integer The number of records to return.
Default value is 100.
No
offset integer The number of records from a collection to skip.
Default value is 0.
No
sort_field string One of the query string parameters for sorting.
Response is sorted by the specified field.
No
sort_direction string Direction of sorting the response list.
Possible values are: ASC / DESC
No
customer_id string The unique id for the customer No
card_number string Number of the customer card No
card_type_id string The unique id for the card type No
state string State of the card
Possible values are: 1 - active
No
is_valid boolean If in validity range - true, before or after validity range - false No

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
cards Card[] Collection of customer cards
total_items integer Count of all found customer cards

Example request

GET <projectURL>/rest-api/customer-interface/v1.0/cards
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

Example response

HTTP/1.1 200 OK
Date: Mon, 22 Jul 2019 12:23:01 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "cards": [
      {
        "card_id": "86a2961d4c1d6204fc3e",
        "customer_id": "8da9b5f32b636e5c0ca",
        "card_type_id": "83d1d11ea3884a5d33",
        "card_number": "2001010183254",
        "state": 2,
        "valid_from": "2019-07-05",
        "valid_to": null,
        "store_id": null,
        "last_change": "2019-07-11 16:35:56"
      },
      {
        "card_id": "8ea6c71d4c8313fd50c",
        "customer_id": "8da9b5f32b636e5c0",
        "card_type_id": "83d1d11ea3884a5d3",
        "card_number": "2001010183255",
        "state": 1,
        "valid_from": "2019-07-05",
        "valid_to": "2059-07-05",
        "store_id": null,
        "last_change": "2019-07-15 17:26:34"
      }
    ],
    "total_items": 2
  }
}


Get a card

Get information about a specific customer card
[badge-blue GET] /cards/{card_id}

Path parameters

Parameter name Type Description
card_id string The unique id of the card

Response

Status code: 200 OK
Output structure : Card

Example request

GET <projectURL>/rest-api/customer-interface/v1.0/cards/86a2961d4c1d6204fc3e
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

Example response

HTTP/1.1 200 OK
Date: Mon, 22 Jul 2019 12:23:01 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "card_id": "86a2961d4c1d6204fc3e",
    "customer_id": "8da9b5f32b636e5c0ca4",
    "card_type_id": "83d1d11ea3884a5d3325",
    "card_number": "2001010183255",
    "state": 2,
    "valid_from": "2019-07-05",
    "valid_to": null,
    "store_id": null,
    "last_change": "2019-07-11 16:35:56"
  }
}


Update a card

Update a specific customer card
[badge-grey PUT] /cards/{card_id}

Path parameters

Parameter name Type Description
card_id string The unique id of the card

Request

Parameter name Type Description Mandatory (Yes/No)
card Card Card resource Yes

Response

Status code: 204 No Content

Example request

PUT <projectURL>/rest-api/customer-interface/v1.0/cards/86a2961d4c1d6204fc3e
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

{
    "card": {
        "card_type_id": "189dd18cff7a4b1a1erd19bcfcf9a9964e2e9f3d7f9d43e967e",
        "card_number": "2001995001037",
        "state":1
  }
}

Example response

HTTP/1.1 204 No Content
Date: Mon, 22 Jul 2019 12:13:31 GMT
Content-Type: application/json; charset=utf-8


Assign free card

Assign a free card in order to the customer
[badge-green POST] /cards/actions/assign-free-card

Action method is available only in Enterprise interface.

Request

Parameter name Type Description Mandatory (Yes/No)
card_type_id string Type of a card that will be assigned Yes
customer_id string Identification of the customer Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
card_id string The unique id of the assigned card

Example request

POST https://<projectURL>/rest-api/enterprise-interface/v1.0/cards/actions/assign-free-card
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmU2ZTBkMjg4MDllMzM3ZDdjNGEEyZGFjZ3NmUzNDljNGYyMzlkOWEwZmQyM2Q0NA==

{
  "card_type_id" :  "86e05affc7a7abefcd513ab400",
  "customer_id" : "85ca0e716e9359939f8027d12b"
}

Example response

HTTP/1.1 200 OK
Date: Tue, 04 Aug 2020 11:01:39 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "card_id": "8fd17bf437555cf56a6ecf05fc"
  }
}


Generate digital card file

Generate file with digital card. File can be generated as a PNG file or file for Apple Wallet.
[badge-green POST] /cards/actions/generate-digital-card-file

Request

Parameter name Type Description Mandatory (Yes/No)
card_id string Id of the card. It will generates file from this card Yes
file_type string Type of the final file
Possible values: png - generates picture in png format /wallet - generates pass package file for Apple Wallet
Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
file_url string Url address of the final file with digital card

Example request

POST https://<projectURL>/rest-api/enterprise-interface/v1.0/cards/actions/generate-digital-card-file
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZVTYxMmFjOTRiMjExN2M2MDdmZTBlNzk2OTUyMjk1OTNmNjIzNTM5NzA1MTFkYmVmNQ==

{
  "card_id": "8bd48117006496e0b178809b8",
  "file_type": "png"
}

Example response

HTTP/1.1 200 OK
Date: Thu, 22 Apr 2021 11:08:54 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "file_url": "https:\/\/dev-carecloud.cortex.cz\/\/crm\/scripts\/generate_mobile_card.php?account=80c4d97a736d98a90badb5128&card=8bd4811700646e0b1788109b8"
  }
}