Getting the Server Hook Configuration

Check the following execution sample to see how to fetch your server hook configuration.

node bin/kii-servercode.js get-hook-config \
  --code-version gulsdf6ful8jvf8uq6fe7vjy6 \
  --site jp \
  --app-id <your_app_id> \
  --app-key <your_app_key> \
  --client-id <your_client_id> \
  --client-secret <your_client_secret> \
  --output-file <output-file>

Here are the options you need to set:

  • --code-version: The version of the server hook configuration to fetch.
  • --site: The server location (jp).
  • --app-id: The AppID.
  • --app-key: An arbitrary value.
  • --client-id: The ClientID.
  • --client-secret: The ClientSecret.
  • --token: (optional) The app admin token. Can be used instead of client-id and client-secret.
  • --output-file: (optional) The output file (e.g /tmp/mycode.js).
  • --http-proxy: (optional) Specify http proxy, in case client is running behind a firewall or cannot access directly to Kii Cloud API. Eg: https://my.proxy:8080

Make sure to set the values you've got on the developer portal for --site, --app-id, --app-key, --client-id and -- client-secret (See Parameters for executing the commands for more information). You can optionally specify the app admin token with --token instead of specifying the ClientID and ClientSecret (See Admin Features to learn how to get the app admin token).

Kii Cloud will return the server hook configuration like this:

17 Jun 17:02:30 - Downloading code version gulsdf6ful8jvf8uq6fe7vjy6...
17 Jun 17:02:32 - Downloaded content:
{
  "kiicloud://users": [
    {
      "when": "USER_CREATED",
      "what": "EXECUTE_SERVER_CODE",
      "endpoint": "adduser"
    },
    {
      "when": "USER_UPDATED",
      "what": "EXECUTE_SERVER_CODE",
      "endpoint": "updateuser"
    },
    {
      "when": "USER_DELETED",
      "what": "EXECUTE_SERVER_CODE",
      "endpoint": "deleteuser"
    }
  ]
}