Wiki Home Settings page == API settings ==

== API settings ==

2024-04-26
api

The following instructions explain how to generate and use the API

  1. When switching the iCafeCloud license between master and slave servers (EU3 to EU4), there is no need to update the API, as it remains unchanged. However, if you switch to a different server group ( EU3 to EU18), the API key must be recreated.
  2. Log in to the Admin panel using the "Admin" account, as only the Admin account can create APIs.
  3. You must use a static IP or a VPS, as the IP will be bound to the token. To ensure optimal API usage, it is recommended to make API calls from a static IP server, such as a VPS, rather than directly from a client device.
  4. You can use either IPv4 or IPv6 for the API IP.
  5. To add more than one IP to the list, separate them with commas ( IP1, IP2, IP3).
  6. From the "Settings" page of the Cloud Panel, add the IP you selected as your server IP under "API Access IP." Then, generate your API key by clicking the "Create" button (Figure 1)
  7. Note that the API key is valid for one year.

Figure 1

  1. The API address is fixed as api.icafecloud.com
  2. Once you create a new API key, the old API key will become invalid. We only support one API key at a time. (Figure 2)

Figure 2

  1. Click the "Copy" button and save your api key. It's only shown once.
  2. API docs https://dev.icafecloud.com/docs/ (Figure 3).

Figure 3

  1. You need to add a http header with the "Authorization: Bearer api_key" to authenticate the API access.
  2. To add parameters on the API use Body and not Headers.[On postman can use Body , Form-data and add parameters. (Figure 4)

Figure 4


  1. The API endpoint URL should always use HTTPS not HTTP.
  2. You can try the API directly on the iCafeCloud dev.icafecloud.com. Follow these steps:
    Click the link to
    https://dev.icafecloud.com/docs/#boot-pcs-apis
    Click the "Try it out" button.
    Fill in the Bearer token and CafeID, which you can find in your iCafeCloud license.
    Click "Send Request" to retrieve data from the PCs.
    This process allows you to interact with and test the API functionalities effectively.(Figure 5)

Figure 5

  1. Notify balance changes to client PC. Once you've initiated the top-up API call, the next step would be to call the pushClientstatus API. This step is crucial as it ensures that the client's PC is notified of the update.
  2. For the API to auto add bonus on topup use:
    To get the bonus =  POST api/v2/cafe/{cafeId}/members/action/fetchBonus
    And use it as parameter at = POST api/v2/cafe/{cafeId}/members/action/topup -> topup_balance_bonus (Figure 6)

Figure 6

Related: