|
1 | | -# databox |
| 1 | +# Databox |
| 2 | +This package is designed to consume the Databox Push API functionality via a Java client. |
2 | 3 |
|
3 | | -Static OpenAPI document of Push API resource |
4 | | -- API version: 0.4.1 |
5 | | - - Build date: 2024-07-11T08:40:29.068083Z[Etc/UTC] |
6 | | - - Generator version: 7.6.0 |
7 | | - |
8 | | -Push API resources Open API documentation |
9 | | - |
10 | | - |
11 | | -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* |
12 | | - |
13 | | - |
14 | | -## Requirements |
15 | | - |
16 | | -Building the API client library requires: |
17 | | -1. Java 1.8+ |
18 | | -2. Maven (3.8.3+)/Gradle (7.2+) |
19 | 4 |
|
20 | 5 | ## Installation |
21 | 6 |
|
22 | | -To install the API client library to your local Maven repository, simply execute: |
23 | | - |
24 | | -```shell |
25 | | -mvn clean install |
26 | | -``` |
27 | | - |
28 | | -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: |
29 | | - |
30 | | -```shell |
31 | | -mvn clean deploy |
32 | | -``` |
33 | | - |
34 | | -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. |
35 | | - |
36 | 7 | ### Maven users |
37 | 8 |
|
38 | 9 | Add this dependency to your project's POM: |
@@ -61,96 +32,42 @@ Add this dependency to your project's build file: |
61 | 32 | } |
62 | 33 | ``` |
63 | 34 |
|
64 | | -### Others |
65 | | - |
66 | | -At first generate the JAR by executing: |
67 | | - |
68 | | -```shell |
69 | | -mvn clean package |
70 | | -``` |
71 | | - |
72 | | -Then manually install the following JARs: |
73 | | - |
74 | | -* `target/databox-2.5.1.jar` |
75 | | -* `target/lib/*.jar` |
76 | | - |
77 | | -## Getting Started |
| 35 | +## Prerequisites |
| 36 | +In use the Databox Push API functionality, please refer to [Databox Developers Page](https://developers.databox.com/), specifically the **Quick Guide** section, where you will learn how to create a **Databox Push API token** which is required for pushing your data. |
78 | 37 |
|
79 | | -Please follow the [installation](#installation) instruction and execute the following Java code: |
| 38 | +## Example |
80 | 39 |
|
81 | 40 | ```java |
82 | | - |
83 | | -// Import classes: |
84 | 41 | import org.databox.ApiClient; |
85 | 42 | import org.databox.ApiException; |
86 | 43 | import org.databox.Configuration; |
87 | | -import org.databox.auth.*; |
88 | | -import org.databox.models.*; |
89 | 44 | import org.databox.api.DefaultApi; |
| 45 | +import org.databox.auth.HttpBasicAuth; |
| 46 | +import org.openapitools.client.model.PushData; |
| 47 | +import org.openapitools.client.model.PushDataAttribute; |
90 | 48 |
|
91 | 49 | public class Example { |
92 | 50 | public static void main(String[] args) { |
93 | 51 | ApiClient defaultClient = Configuration.getDefaultApiClient(); |
94 | 52 | defaultClient.setBasePath("https://push.databox.com"); |
95 | | - |
96 | | - // Configure HTTP basic authorization: basicAuth |
| 53 | + defaultClient.addDefaultHeader("Accept", "application/vnd.databox.v2+json"); |
| 54 | + |
97 | 55 | HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth"); |
98 | | - basicAuth.setUsername("YOUR USERNAME"); |
99 | | - basicAuth.setPassword("YOUR PASSWORD"); |
| 56 | + basicAuth.setUsername("Your_Databox_API_Token"); |
| 57 | + |
| 58 | + PushData data = new PushData() |
| 59 | + .key("Metric_name") // e.g. sales |
| 60 | + .value(123f) |
| 61 | + .date("Date_in_ISO8601") // e.g. "2024-08-01T00:00:00Z" |
| 62 | + .unit("Unit") // optional - e.g. USD |
| 63 | + .attributes(List.of(new PushDataAttribute().key("Dimension_name").value("Dimension_value"))); // optional - e.g. currency & USD |
100 | 64 |
|
101 | 65 | DefaultApi apiInstance = new DefaultApi(defaultClient); |
102 | 66 | try { |
103 | | - apiInstance.dataDelete(); |
| 67 | + apiInstance.dataPost(List.of(data)); |
104 | 68 | } catch (ApiException e) { |
105 | | - System.err.println("Exception when calling DefaultApi#dataDelete"); |
106 | | - System.err.println("Status code: " + e.getCode()); |
107 | | - System.err.println("Reason: " + e.getResponseBody()); |
108 | | - System.err.println("Response headers: " + e.getResponseHeaders()); |
109 | 69 | e.printStackTrace(); |
110 | 70 | } |
111 | 71 | } |
112 | 72 | } |
113 | | - |
114 | | -``` |
115 | | - |
116 | | -## Documentation for API Endpoints |
117 | | - |
118 | | -All URIs are relative to *https://push.databox.com* |
119 | | - |
120 | | -Class | Method | HTTP request | Description |
121 | | ------------- | ------------- | ------------- | ------------- |
122 | | -*DefaultApi* | [**dataDelete**](docs/DefaultApi.md#dataDelete) | **DELETE** /data | |
123 | | -*DefaultApi* | [**dataMetricKeyDelete**](docs/DefaultApi.md#dataMetricKeyDelete) | **DELETE** /data/{metricKey} | |
124 | | -*DefaultApi* | [**dataPost**](docs/DefaultApi.md#dataPost) | **POST** /data | |
125 | | -*DefaultApi* | [**metrickeysGet**](docs/DefaultApi.md#metrickeysGet) | **GET** /metrickeys | |
126 | | -*DefaultApi* | [**metrickeysPost**](docs/DefaultApi.md#metrickeysPost) | **POST** /metrickeys | |
127 | | -*DefaultApi* | [**pingGet**](docs/DefaultApi.md#pingGet) | **GET** /ping | |
128 | | - |
129 | | - |
130 | | -## Documentation for Models |
131 | | - |
132 | | - - [ModelApiResponse](docs/ModelApiResponse.md) |
133 | | - - [PushData](docs/PushData.md) |
134 | | - - [PushDataAttribute](docs/PushDataAttribute.md) |
135 | | - - [State](docs/State.md) |
136 | | - |
137 | | - |
138 | | -<a id="documentation-for-authorization"></a> |
139 | | -## Documentation for Authorization |
140 | | - |
141 | | - |
142 | | -Authentication schemes defined for the API: |
143 | | -<a id="basicAuth"></a> |
144 | | -### basicAuth |
145 | | - |
146 | | -- **Type**: HTTP basic authentication |
147 | | - |
148 | | - |
149 | | -## Recommendation |
150 | | - |
151 | | -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. |
152 | | - |
153 | | -## Author |
154 | | - |
155 | | - |
156 | | - |
| 73 | +``` |
0 commit comments