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
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
- 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
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
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
Therefore, it cannot modify user & card data.
Method: PUT
Request
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}
}
}
}