Welcome to Airfob Support Center.

Login Token & User / Card API

This section explains how to login & manage user through Airfob Portal APIs
Written by MOCA System
Updated 8 months ago

Before start

Airfob portal account and portal site need to be created in advance to use Airfob portal API. For more information on how to sign up and create a portal site, please refer to the below links. 

https://mocasystemen.crunch.help/admin/create-account
https://mocasystemen.crunch.help/admin/create-site

Portal Login

Your system needs to get 'token value' after login, and use it as bearer in the Authroization header with your following API requests. 

Each token has one hour timelimit for its validiay. Once it expires, it needs to get a new token and change the bearer token to the new one for further API requests.

API Base URL

api.mc.mocainc.com

Login / Token Request

URL: /login
Method: POST
Request

Response

Example

POST - /login
Request:
{"email": "api@mocainc.com", "password": "moca1!system"}

Response:
{"status":200,"message":"success",
 "record":{
     "email":"api.mocainc.com",
     "accountType":"sitemanager",
     "accessToken":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhYyI6InNpdGVtYW5hZ2VyIiwiZW0iOiJjaGFybGVzQHN1cHJlbWEuY28ua3IiLCJleHAiOjE1Njk4MDYxNTYsImlhdCI6MTU2OTgwMjU1Nn0.1QR22Y41kEoHwwWbkrq5BJwcfg4OyWszkSgLIUT18Zw",
     "name":"TestUser",
     "accountStatus":"ACTIVATED"
     }
}

User & Card Creation 

- User & card creation can be done together.
- Card type is automatically assigned acccording to the site card type.
- If the site is set to use 'Regular', the regular card will be issued.
  If the site is set to use 'Dynamic', the dynamic card will be issued. 

URL: /user/card
Method: POST
Request

Response 

 Example

POST - /user/card
Request:
{"siteId": "0",
 "user": {
     "userKey": "1",
     "email": "moca@mocainc.com",
     "phone":"+821022223333",
     "meta":"{\"name\":\"모카\",\"department\":\"모바일\",\"title\":\"팀원\"}",
     "portraitData":"BASE64ENCODED-BINARY",
     "feedType": "EMAIL",
     }
 "card": {
      "number":"8352800",
      "startDate":1587778190617,
      "endDate":1587778250617}
      }
}
Response:
{"status":200,"message":"success",
 "record": {
      "userId":"3",
      "userKey":"1",
      "email":"moca@mocainc.com",
      "phone":"+821022223333",
      "meta":"{\"name\":\"모카\",\"department\":\"모바일\",\"title\":\"팀원\"}",
      "portrait":"https://IMG-URL",
      "feedType":"EMAIL",
      "card":{
          "id":"43548",
          "number":"8352800",
          "status":"INACTIVE",
          "cardType":"DYNAMIC",
          "format":"GENERAL",
          "cardTypeDesc":"GENERAL",
          "startDate":1587778190617,
          "endDate":1587778250617}
          }
      }
}

User & Card Search

URL: /users/search
Method: POST
Request

Response

Example

POST - /users/search
Request:
{"siteId": "0"}
Response:
{"status":200,"message":"success","total":"1",
 "records":[
     {"userId":"3",
      "userKey":"1",
      "email":"moca@mocainc.com",
      "phone":"+821022223333",
      "meta":"{\"name\":\"모카\",\"department\":\"모바일\",\"title\":\"팀원\"}",
      "portrait":"https://IMG-URL",
      "feedType":"EMAIL",
      "card":{
          "id":"43548",
          "number":"8352800",
          "status":"INACTIVE",
          "cardType":"DYNAMIC",
          "format":"GENERAL",
          "cardTypeDesc":"GENERAL",
          "startDate":1587778190617,
          "endDate":1587778250617}
          }
      ]
}

User Delete

URL: /users/delete
Method: POST
Request
- List

Response

Example

POST - /users/delete
Request:
[{"userId": "303"},
 {"userId": "304"}
]
Response:
{"status":207,"message":"Multi-Status",
 "total":"2","success":"2","failure":"0",
 "records":[
     {"status":200,"message":"success"},
     {"status":200,"message":"success"}
     ]
}

Card Delete

In order to delete the card, the status value needs to be 'FORCE_DELETE.

URL: /cards
Method: PUT
Request
- List

Response

Example

PUT - /cards
Request:
[{"cardId": "202"
  "status": "FORCE_DELETE"},
 {"cardId": "203",
  "status": "FORCE_DELETE"}
]
Response:
{"status":207,"message":"Multi-Status",
 "total":"2","success":"2","failure":"0",
 "records":[
     {"status":200,"message":"success",
      "record": {"status": "DELETE"}},
     {"status":200,"message":"success",
      "record": {"status": "DELETE"}}
     ]
}

Card Resend

Resend is for sending the download link again. 
Therefore, it cannot be processed when the card is already activated. 

URL: /card/send
Method: POST
Request

Response

- None

Example

POST - /card/send
Request:
{"siteId": "0", "number": "43548"}

Response:
{"status":200,"message":"success"}

Card Reissue

Reissue is for the same mobile card data resend.
Therefore, it cannot modify user & card data. 
URL: /user/card
Method: PUT
Request
Response
Example
PUT - /user/card
Request:
{"siteId": "0",
 "userId" : "3",
 "card": {
      "startDate":1587778190617,
      "endDate":1587778250617}
      }
}
Response:
{"status":200,"message":"success",
 "record": {
      "userId":"3",
      "userKey":"1",
      "email":"moca@mocainc.com",
      "phone":"+821022223333",
      "meta":"{\"name\":\"모카\",\"department\":\"모바일\",\"title\":\"팀원\"}",
      "portrait":"https://IMG-URL",
      "feedType":"EMAIL",
      "card":{
          "id":"43548",
          "number":"8352800",
          "status":"INACTIVE",
          "cardType":"DYNAMIC",
          "format":"GENERAL",
          "cardTypeDesc":"GENERAL",
          "startDate":1587778190617,
          "endDate":1587778250617}
          }
      }
}
Did this answer your question?