@@ -15,24 +15,16 @@ Formkiq API: Document Management Platform API using JWT Authentication
1515
1616Building the API client library requires:
17171 . Java 1.8+
18- 2 . Maven (3.8.3+)/ Gradle (7.2+)
18+ 2 . Gradle (7.2+)
1919
2020## Installation
2121
2222To install the API client library to your local Maven repository, simply execute:
2323
2424``` shell
25- mvn clean install
25+ ./gradlew clean build
2626```
2727
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-
3628### Maven users
3729
3830Add this dependency to your project's POM:
@@ -66,7 +58,7 @@ Add this dependency to your project's build file:
6658At first generate the JAR by executing:
6759
6860``` shell
69- mvn clean package
61+ ./gradlew clean build
7062```
7163
7264Then manually install the following JARs:
@@ -91,18 +83,53 @@ import com.formkiq.client.api.AdvancedDocumentSearchApi;
9183public class Example {
9284 public static void main (String [] args ) {
9385 ApiClient defaultClient = Configuration . getDefaultApiClient();
94- defaultClient. setBasePath(" http://localhost" );
95- // Configure AWS Signature V4 authorization
96- defaultClient. setAWS4Configuration(" YOUR_ACCESS_KEY" , " YOUR_SECRET_KEY" , " REGION" , " SERVICE" )
86+
87+ // Pick one of the following authorization methods (JWT / IAM / KEY)
88+ //
89+ // 1. For JWT authorization
90+ // From the FormKiQ installation CloudFormation Outputs, find the value for HttpApiUrl
91+ defaultClient. setBasePath(" <HttpApiUrl>" );
92+ defaultClient. addDefaultHeader(" Authorization" , < JWT Access Token > );
93+
94+ // 2. For IAM authorization
95+ // From the FormKiQ installation CloudFormation Outputs, find the value for IamApiUrl
96+ defaultClient. setBasePath(" <IamApiUrl>" );
97+ defaultClient. setAWS4Configuration(" YOUR_ACCESS_KEY" , " YOUR_SECRET_KEY" , " REGION" , " execute-api" )
98+
99+ // 3. For Key authorization
100+ // From the FormKiQ installation CloudFormation Outputs, find the value for KeyApiUrl
101+ defaultClient. setBasePath(" <KeyApiUrl>" );
102+ defaultClient. addDefaultHeader(" Authorization" , < Api Key > );
97103
98- AdvancedDocumentSearchApi apiInstance = new AdvancedDocumentSearchApi (defaultClient);
99- String documentId = " documentId_example" ; // String | Document Identifier
100- String siteId = " siteId_example" ; // String | Site Identifier
104+ // Add New Document
105+ DocumentsApi apiInstance = new DocumentsApi (defaultClient);
106+ AddDocumentRequest addDocumentRequest = new AddDocumentRequest (); // AddDocumentRequest |
107+ String siteId = null ; // String | Site Identifier
108+ String shareKey = null ; // String | Share Identifier
109+ try {
110+ AddDocumentResponse result = apiInstance. addDocument(addDocumentRequest, siteId, shareKey);
111+ System . out. println(result);
112+ } catch (ApiException e) {
113+ System . err. println(" Exception when calling DocumentsApi#addDocument" );
114+ System . err. println(" Status code: " + e. getCode());
115+ System . err. println(" Reason: " + e. getResponseBody());
116+ System . err. println(" Response headers: " + e. getResponseHeaders());
117+ e. printStackTrace();
118+ }
119+
120+ // Get Documents
121+ DocumentsApi apiInstance = new DocumentsApi (defaultClient);
122+ String date = null ; // String | Fetch documents inserted on a certain date (yyyy-MM-dd)
123+ String tz = null ; // String | UTC offset to apply to date parameter (IE: -0600)
124+ String next = null ; // String | Next page of results token
125+ String previous = null ; // String | Previous page of results token
126+ String siteId = null ; // String | Site Identifier
127+ String limit = " 10" ; // String | Limit Results
101128 try {
102- DeleteFulltextResponse result = apiInstance. deleteDocumentFulltext(documentId, siteId);
129+ GetDocumentsResponse result = apiInstance. getDocuments(date, tz, next, previous, siteId, limit );
103130 System . out. println(result);
104131 } catch (ApiException e) {
105- System . err. println(" Exception when calling AdvancedDocumentSearchApi#deleteDocumentFulltext " );
132+ System . err. println(" Exception when calling DocumentsApi#getDocuments " );
106133 System . err. println(" Status code: " + e. getCode());
107134 System . err. println(" Reason: " + e. getResponseBody());
108135 System . err. println(" Response headers: " + e. getResponseHeaders());
0 commit comments