GET /v1/account/apikeys
GET https://api.reporting.cloud/v1/account/apikeys
Description
Lists the API keys of the account, each with its key and the flag active, which is always true: a deleted key leaves the list. See API Keys.
Examples
Request:
curl username:password GET "https://api.reporting.cloud/v1/account/apikeys"
Results:
[
{"key":"NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA","active":true},
{"key":"oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI","active":true},
{"key":"egGfYGpz7lf4alIl1iZusx5aB4se2QdMbSm5rIsoFI","active":true},
{"key":"CvAu0RbMHGhowxs7KT0vBmk2bzYvcFzGr23T2ugS5Y","active":true}
]
Request:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using TXTextControl.ReportingCloud;
class RCSamples
{
public static void ListAPIKeys()
{
ReportingCloud rc = new ReportingCloud(
"username",
"password",
new Uri("https://api.reporting.cloud"));
try
{
List<APIKey> apiKeys = rc.GetAccountAPIKeys();
foreach (APIKey apiKey in apiKeys)
{
Console.WriteLine(apiKey.Key + " (active: " + apiKey.Active + ")");
}
}
catch (Exception e)
{
Console.WriteLine("An error occurred: " + e.Message);
}
}
}
Results:
NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA (active: True)
oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI (active: True)
egGfYGpz7lf4alIl1iZusx5aB4se2QdMbSm5rIsoFI (active: True)
CvAu0RbMHGhowxs7KT0vBmk2bzYvcFzGr23T2ugS5Y (active: True)
Request:
import com.textcontrol.reportingcloud.APIKey;
import com.textcontrol.reportingcloud.ReportingCloud;
import java.io.IOException;
import java.util.List;
public class ReportingCloudSample {
public static void main(String[] args) throws IOException {
ReportingCloud r = new ReportingCloud("username", "password");
List<APIKey> apiKeys = r.getAPIKeys();
for (APIKey apiKey : apiKeys) {
System.out.println(apiKey.getKey() + " (active: " + apiKey.getIsActive() + ")");
}
}
}
Results:
NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA (active: true)
oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI (active: true)
egGfYGpz7lf4alIl1iZusx5aB4se2QdMbSm5rIsoFI (active: true)
CvAu0RbMHGhowxs7KT0vBmk2bzYvcFzGr23T2ugS5Y (active: true)
Request:
#!/usr/bin/env ruby
require "txtextcontrol/reportingcloud"
reporting_cloud = TXTextControl::ReportingCloud::ReportingCloud.new("username", "password")
api_keys = reporting_cloud.get_api_keys
api_keys.each { |api_key| puts "#{api_key.key} (active: #{api_key.is_active})" }
Results:
NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA (active: true)
oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI (active: true)
egGfYGpz7lf4alIl1iZusx5aB4se2QdMbSm5rIsoFI (active: true)
CvAu0RbMHGhowxs7KT0vBmk2bzYvcFzGr23T2ugS5Y (active: true)
Request:
require_once __DIR__ . '/vendor/autoload.php';
use TextControl\ReportingCloud\ReportingCloud;
$reportingCloud = new ReportingCloud([
'api_key' => (string) getenv('REPORTINGCLOUD_API_KEY'),
]);
var_dump($reportingCloud->getApiKeys());
Results:
array(4) {
[0]=>
array(2) {
["key"]=>
string(42) "NP9trbSJIByk109sLWa2euvXT977rU4W1G5BjvtCXA"
["active"]=>
bool(true)
}
[1]=>
array(2) {
["key"]=>
string(41) "oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI"
["active"]=>
bool(true)
}
[2]=>
array(2) {
["key"]=>
string(42) "egGfYGpz7lf4alIl1iZusx5aB4se2QdMbSm5rIsoFI"
["active"]=>
bool(true)
}
[3]=>
array(2) {
["key"]=>
string(42) "CvAu0RbMHGhowxs7KT0vBmk2bzYvcFzGr23T2ugS5Y"
["active"]=>
bool(true)
}
}
Authorization
This endpoint requires a "ReportingCloud-APIKey" or a "Basic" user authorization to access the user account, data and templates. Only one of these two methods is required.
API Keys describes how to create an API key, and Authentication explains both header forms.
ReportingCloud-APIKey
| Header field | Description |
|---|---|
| Authorization | Required. A valid ReportingCloud account is required. The Authorization field is constructed as follows: An API key needs to be generated in the portal or with PUT /v1/account/apikey. The authorization method and a space, "ReportingCloud-APIKey ", is then put before the actual API key string. For example: Authorization: ReportingCloud-APIKey oMDM4MrAqL9QEOpyzupnQW5NjvCNtvE5cVDaaLqxI |
Basic
| Header field | Description |
|---|---|
| Authorization | Required. A valid ReportingCloud account is required. The Authorization field is constructed as follows: The user name and password are combined into a string separated by a colon, for example username:password. The resulting string is encoded using the RFC2045-MIME variant of Base64, except not limited to 76 char/line. The authorization method and a space, "Basic ", is then put before the encoded string. For example: Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l |
Success Response
| Status | Description |
|---|---|
| 200 | On success, the HTTP status code in the response header is 200 (OK). The response body contains an array of ReportingCloud APIKey objects. |
APIKey
| Name | Type | Value | Optional |
|---|---|---|---|
| key | String | The actual API key that belongs to the account. | no |
| active | Boolean | Specifies whether the API key is active or not. Not used yet: every key reads true, and a deleted key is removed from the list. | no |
Error Response
| Status | Description |
|---|---|
| 403 | A 403 (Forbidden) is returned, if the user is not authorized. |
| 405 | A 405 (Method Not Allowed) is returned, if the request uses another HTTP method than GET. The Allow header of the response names GET. |
| 500 | A 500 (Internal Server Error) is returned, if the request has no Authorization header, an empty one or one that is not the authorization method, a space and the credentials. |