External APIReference and Troubleshooting

Language-Specific Examples

Each example below demonstrates how to set the Authorization header, make a request, and handle the response. All examples use the Get API Request Logs endpoint as a reference.

Base URL: https://client-api.wappcloud.com/api/v1

cURL

curl -X GET "https://client-api.wappcloud.com/api/v1/external/api-requests" \
  -H "x-api-key: your_api_key_here" \
  -H "Authorization: Bearer your_access_token_here"

JavaScript (Node.js)

const fetch = require('node-fetch');
 
async function main() {
  const response = await fetch('https://client-api.wappcloud.com/api/v1/external/api-requests', {
    method: 'GET',
    headers: {
      'x-api-key': 'your_api_key_here',
      'Authorization': 'Bearer your_access_token_here'
    }
  });
 
  const data = await response.json();
  console.log(data);
}
 
main();

PHP

<?php
$curl = curl_init();
 
curl_setopt_array($curl, [
  CURLOPT_URL => 'https://client-api.wappcloud.com/api/v1/external/api-requests',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'x-api-key: your_api_key_here',
    'Authorization: Bearer your_access_token_here'
  ],
]);
 
$response = curl_exec($curl);
curl_close($curl);
 
echo $response;
?>

Python

import requests
 
url = 'https://client-api.wappcloud.com/api/v1/external/api-requests'
headers = {
    'x-api-key': 'your_api_key_here',
    'Authorization': 'Bearer your_access_token_here'
}
 
response = requests.get(url, headers=headers)
print(response.json())

Java

import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class ApiExample {
    public static void main(String[] args) throws Exception {
        URL url = new URL("https://client-api.wappcloud.com/api/v1/external/api-requests");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("x-api-key", "your_api_key_here");
        conn.setRequestProperty("Authorization", "Bearer your_access_token_here");
 
        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String inputLine;
        StringBuilder response = new StringBuilder();
        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();
 
        System.out.println(response.toString());
    }
}

C

#include <stdio.h>
#include <curl/curl.h>
 
int main(void) {
    CURL *curl = curl_easy_init();
    if (curl) {
        struct curl_slist *headers = NULL;
        headers = curl_slist_append(headers, "x-api-key: your_api_key_here");
        headers = curl_slist_append(headers, "Authorization: Bearer your_access_token_here");
 
        curl_easy_setopt(curl, CURLOPT_URL, "https://client-api.wappcloud.com/api/v1/external/api-requests");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
 
        curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        curl_slist_free_all(headers);
    }
    return 0;
}

C++

#include <iostream>
#include <curl/curl.h>
 
int main() {
    CURL *curl = curl_easy_init();
    if (curl) {
        struct curl_slist *headers = nullptr;
        headers = curl_slist_append(headers, "x-api-key: your_api_key_here");
        headers = curl_slist_append(headers, "Authorization: Bearer your_access_token_here");
 
        curl_easy_setopt(curl, CURLOPT_URL, "https://client-api.wappcloud.com/api/v1/external/api-requests");
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
 
        curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        curl_slist_free_all(headers);
    }
    return 0;
}

Common Errors & Troubleshooting

401 Unauthorized

Missing or invalid API key.

Possible Causes:

  • Expired token.

  • Incorrect token.

Resolution:

  • Generate a new token.

  • Verify the Authorization header format.

400 Bad Request

Invalid query parameters.

Resolution:

  • Check all query parameter names and formats.

  • Ensure date fields follow YYYY-MM-DD format.

  • Ensure boolean fields are passed as true or false.

Access Denied

Possible Causes:

  • Feature not available in current subscription plan.

  • Missing required permissions.

Resolution:

  • Upgrade your subscription plan.

  • Contact your administrator.

Unauthorized Request

Possible Causes:

  • Missing Authorization header.

  • Incorrect Bearer token format.

Resolution:

  • Add the Authorization header to your request.

  • Verify the token format: Authorization: Bearer <your_token>


Security Best Practices

  • Never expose API Keys publicly.

  • Never expose Access Tokens publicly.

  • Store credentials in environment variables.

  • Rotate credentials periodically.

  • Use HTTPS for all requests.

  • Restrict access to authorized users only.

  • Keep your access token confidential and never commit it to version control.