Working with API

v2 API - https://vemcount.docs.apiary.io/ v3 API - https://vemcount.app/api/docs/v3

For Beginners

Make your first API work

  • Retrieving a bearer token
    E.g. (v3 API) Using a cmd console in Windows or terminal from Mac OS
curl -H "Content-Type: application/json" -H "Accept: application/json" -d $'{"user_name": "YOURUSERNAME","password": "YOURPASSWORD"}' -X POST https://vemcount.app/api/v3/auth/login

Sample Response:{"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI1IiwianRpIjoiZDFhM2M5NDgxYjI3NjkwOWZkZGY2NWE3NTQ4NjUzYjFjNDc4ZGQ4MmFkMGNiYTg5OTQzYjVlNTMyZDMxMDA1ODBiMzlhZDc4MmU2YmFjODEiLCJpYXQiOjE2NTY1NjA5MjIuOTkwODkxLCJuYmYiOjE2NTY1NjA5MjIuOTkwODkzLCJleHAiOjE2NTY1ODI1MjIuNzQxOTA0LCJzdWIiOiIxODgyNSIsInNjb3BlcyI6W119.fUUTbgmyvr7x3LMn0VOOQ-RTlvq6IbuD12VWsmemwoLsj67WPlQS9eprurpge4Ochk2thxwYxD5odbmvW9aRZshpVcdiKrqAGsLzQDGHIGPbna_wiqu884ywAFNtI6aWoJycy_vIm1m16L9BBHXclRznbwQlWpmKyzWBEM4LTGNP5H_xuB2jDZ0niwhMZQ9EeG7LiSv6EbB4gxIBZJPaq_uO-bzKml0CzX1PjYsntjxyG_qbQjPLgO01z-Pfx-AV49J2eB3q6Zr2T7xedbw4x3EshJqojU23UMwmJR2gyEpU9-mGewGrjPPknjqdpgPwexvcD5Ilu3vuHvsEtg80mDfOQjShrpEdgLXXirlUTPQxZIr4ey8WFWFV24IbbTzm8ED0AodPM7mW8EGLp0pDCDzGfnapLK7j7yUGlJBNlPrOJYICtvBCX_9Eaq7hSebA62uGK7yCOi-7c2ASAhgtHWBmVrn7v93x178FVhq19xtBpqIgsy947Z8MZOcBv6BndttELn4JtNTS_PkV3UN7ZuFd71Ro2QNm2YH905VODStIdaICAsLVMplFEY9x2rg778Rj0KHQqJVFxNgc9UXTvT99z5W7Mj0KGL8ReBTBcwQE6UefR3JyKRx7O0QPqzcCxznnQtLeTydmti6z0YwLR5EKw1sPjUAY2JddSf4kNM8","token_type":"bearer","expires_at":"2022-06-30 09:48:42"}%

 

  • Use the bearer tokenPut the following to your header

Accept: application/json
Content-Type: application/json
Authorization: Bearer YOUR-TOKEN-HERE

  • E.g. Try to get a Live Count

(v3 API) Using a cmd console in Windows or terminal from Mac OS

curl -H "Content-Type: application/json" -H "Accept: application/json"  -H "Authorization: Bearer YOUR-TOKEN-HERE" -d $'{"source":"locations","data":"LOCATION-ID","period":"15"}' -X POST https://vemcount.app/api/v3/report/live-count

The location ID can be found in your location list in Vemcount App

Sample Response:
{"data":{"12345":{"count_in":10,"count_out":15}},"meta":{"start_dt":"2022-06-30 11:34:00","end_dt":"2022-06-30 11:48:59"}}%

 

  • Try to get a Report
    E.g. (v3 API) Using a cmd console in Windows or terminal from Mac OS
curl -H "Content-Type: application/json" -H "Accept: application/json"  -H "Authorization: Bearer YOUR-TOKEN-HERE" -d $'{"source":"locations","data":"LOCATION-ID"}' -X POST https://vemcount.app/api/v3/report
  • Q&A
    • Q: How can I get an API key ?
      A: Either API Key or Username/Password can get the bearer token, use API key can help to hide the private credentials. For the API key generation, click your username in the Vemcount App, and click user settings. There's an API key tab and click the generate.

    • Q: Why the data is different to the Vemcount App report
      A: Please check your time zone settings in Vemcount user setting. The data you pulling via API is based on your time zone, which means you need to adjust the payloads or change your time zone setting in order to get the correct data.