GET /v1/account/settings
GET https://api.reporting.cloud/v1/account/settings
Description
Returns the serial number of the account, its quotas and how much of each is used: created documents, stored templates and spell checking transactions, each with its maximum. validUntil is the end of the subscription, and null on a trial account. See Plans and Licensing.
Examples
Request:
curl username:password GET "https://api.reporting.cloud/v1/account/settings"
Results:
{
"serialNumber": "Trial",
"createdDocuments": 13,
"uploadedTemplates": 4,
"maxDocuments": 1000,
"maxTemplates": 20,
"validUntil": null,
"proofingTransactions": 10,
"maxProofingTransactions": 10000
}
Request:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using TXTextControl.ReportingCloud;
class RCSamples
{
public static void AccountSettings()
{
ReportingCloud rc = new ReportingCloud(
"username",
"password",
new Uri("https://api.reporting.cloud"));
try
{
AccountSettings settings = rc.GetAccountSettings();
Console.WriteLine("Serial number: " + settings.SerialNumber);
Console.WriteLine("Uploaded templates: " + settings.UploadedTemplates);
}
catch (Exception e)
{
Console.WriteLine("An error occurred: " + e.Message);
}
}
}
Results:
Serial number: Trial
Uploaded templates: 4
Request:
import com.textcontrol.reportingcloud.AccountSettings;
import com.textcontrol.reportingcloud.ReportingCloud;
import java.io.IOException;
public class ReportingCloudSample {
public static void main(String[] args) throws IOException {
ReportingCloud r = new ReportingCloud("username", "password");
AccountSettings settings = r.getAccountSettings();
System.out.println("Serial number: " + settings.getSerialNumber());
System.out.println("Uploaded templates: " + settings.getUploadedTemplates());
System.out.println("Max documents: " + settings.getMaxDocuments());
System.out.println("Max templates: " + settings.getMaxTemplates());
System.out.println("Valid until: " + settings.getValidUntil());
}
}
Results:
Serial number: XX-XXXXXXXXXX
Uploaded templates: 2
Max documents: 100000
Max templates: 500
Valid until: 2020-01-01T00:00Z
On an account whose validUntil is null, such as a trial account, getAccountSettings() throws a JsonParseException: SDK 1.3 reads the date with getAsString(), which a JSON null refuses.
Request:
#!/usr/bin/env ruby
require "txtextcontrol/reportingcloud"
reporting_cloud = TXTextControl::ReportingCloud::ReportingCloud.new("username", "password")
account_settings = reporting_cloud.get_account_settings
puts "Serial number: #{account_settings.serial_number}"
puts "Uploaded templates: #{account_settings.uploaded_templates}"
puts "Max documents: #{account_settings.max_documents}"
puts "Max templates: #{account_settings.max_templates}"
puts "Valid until: #{account_settings.valid_until.to_s}"
Results:
Serial number: XX-XXXXXXXXXX
Uploaded templates: 2
Max documents: 100000
Max templates: 500
Valid until: 2020-01-01T00:00:00+00:00
Request:
require_once __DIR__ . '/vendor/autoload.php';
use TextControl\ReportingCloud\ReportingCloud;
$reportingCloud = new ReportingCloud([
'api_key' => (string) getenv('REPORTINGCLOUD_API_KEY'),
]);
var_dump($reportingCloud->getAccountSettings());
Results:
array(8) {
["serial_number"]=>
string(13) "XX-0000000000"
["created_documents"]=>
int(131)
["uploaded_templates"]=>
int(2)
["max_documents"]=>
int(20000)
["max_templates"]=>
int(100)
["valid_until"]=>
int(1517785200)
["proofing_transactions"]=>
int(12)
["max_proofing_transactions"]=>
int(50000)
}
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 a ReportingCloud AccountSettings object. |
AccountSettings
| Name | Type | Value | Optional |
|---|---|---|---|
| serialNumber | String | The serial number that is attached to the account: Trial for a trial account, or the 13-character serial number of a subscription. | no |
| validUntil | DateTime (String) | Returns the date until the current subscription is valid. The date string includes the time zone of the server (UTC). Sample: 2016-06-06T11:25:44+00:00. null for a trial account. | no |
| createdDocuments | Integer | The number of created documents in the current month. | no |
| uploadedTemplates | Integer | The number of templates in the template storage, including the demo template sample_invoice.tx. | no |
| maxDocuments | Integer | The maximum number of documents that can be created per month. | no |
| maxTemplates | Integer | The maximum number of templates that can be uploaded to the template storage. | no |
| proofingTransactions | Integer | The number of proofing transactions in the current month. | no |
| maxProofingTransactions | Integer | The maximum number of proofing transactions per month. | 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. |