Skip to content

Commit 37b56b2

Browse files
author
Jonathan Wenger
committed
Update readme.
1 parent 8867b8b commit 37b56b2

File tree

1 file changed

+3
-118
lines changed

1 file changed

+3
-118
lines changed

README.md

Lines changed: 3 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,15 @@ Add this dependency to your project's build file:
4444

4545
```groovy
4646
repositories {
47-
mavenCentral() // Needed if the 'Avalara.SDK' jar has been published to maven central.
48-
mavenLocal() // Needed if the 'Avalara.SDK' jar has been published to the local maven repo.
47+
mavenCentral()
48+
mavenLocal()
4949
}
5050
5151
dependencies {
52-
implementation "Avalara.SDK:Avalara.SDK:24.12.0"
52+
implementation 'net.avalara:avalara-sdk:24.12.0'
5353
}
5454
```
5555

56-
### Others
57-
58-
At first generate the JAR by executing:
59-
60-
```shell
61-
mvn clean package
62-
```
63-
64-
Then manually install the following JARs:
65-
66-
- `target/Avalara.SDK-2.4.29.jar`
67-
- `target/lib/*.jar`
68-
6956
## Getting Started
7057

7158
Please follow the [installation](#installation) instruction and execute the following Java code:
@@ -108,112 +95,10 @@ public class MandatesApiExample {
10895

10996
```
11097

111-
## Documentation for Authorization
112-
113-
Authentication schemes defined for the API:
114-
<a name="OAuth Client Credentials Flow"></a>
115-
116-
### OAuth Client Credentials
117-
118-
- **Type**: OAuth
119-
- **Flow**: client_credentials
120-
- **Scopes**:
121-
- avatax_api: avatax_api scope.
122-
123-
```java
124-
import Avalara.SDK.*;
125-
import Avalara.SDK.auth.*;
126-
import Avalara.SDK.model.Avatax.*;
127-
import Avalara.SDK.api.Avatax.AddressesApi;
128-
129-
public class AddressesApiExample {
130-
131-
public static void main(String[] args) {
132-
Configuration configuration = new Configuration();
133-
configuration.setAppName("Test");
134-
configuration.setAppVersion("1.0");
135-
configuration.setMachineName("LocalBox");
136-
configuration.setTimeout(5000);
137-
configuration.setEnvironment(AvaTaxEnvironment.Sandbox);
138-
// Configure OAUTH2 Client Credentials flow
139-
configuration.setClientId("YOUR CLIENT_ID");
140-
configuration.setClientSecret("YOUR CLIENT_SECRET");
141-
142-
ApiClient apiClient = new ApiClient(configuration);
143-
AddressesApi apiInstance = new AddressesApi(apiClient);
144-
String xAvalaraClient = "Swagger UI; 22.7.0; Custom; 1.0"; // String | Identifies the software you are using to call this API. For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) .
145-
AddressValidationInfo body = new AddressValidationInfo(); // AddressValidationInfo | The address to resolve
146-
try {
147-
// SDK will fetch OAuth token using client creds flow with Avalara Identity and append Authorization header to the request with the access token.
148-
AddressResolutionModel result = apiInstance.resolveAddressPost(xAvalaraClient, body);
149-
System.out.println(result);
150-
} catch (ApiException e) {
151-
System.err.println("Exception when calling AddressesApi#resolveAddressPost");
152-
System.err.println("Status code: " + e.getCode());
153-
System.err.println("Reason: " + e.getResponseBody());
154-
System.err.println("Response headers: " + e.getResponseHeaders());
155-
e.printStackTrace();
156-
}
157-
}
158-
}
159-
```
160-
161-
<a name="OAuth Device Code Flow"></a>
162-
163-
### OAuth Device Code Flow
164-
165-
- **Type**: OAuth
166-
- **Flow**: device_code
167-
- **Scopes**:
168-
- avatax_api: avatax_api scope.
169-
170-
```java
171-
import Avalara.SDK.*;
172-
import Avalara.SDK.auth.*;
173-
import Avalara.SDK.model.Avatax.*;
174-
import Avalara.SDK.api.Avatax.AddressesApi;
175-
176-
public class AddressesApiExample {
177-
178-
public static void main(String[] args) {
179-
Configuration configuration = new Configuration();
180-
configuration.setAppName("Test");
181-
configuration.setAppVersion("1.0");
182-
configuration.setMachineName("LocalBox");
183-
configuration.setTimeout(5000);
184-
configuration.setEnvironment(AvaTaxEnvironment.Sandbox);
185-
// Configure OAUTH2 Device code flow
186-
configuration.setClientId("YOUR CLIENT_ID");
187-
188-
DeviceAuthResponse response = ApiClientHelper.initiateDeviceAuthorizationOAuth(null, configuration);
189-
DeviceAccessTokenResponse tokenResponse = ApiClientHelper.getAccessTokenForDeviceFlow(response.getDeviceCode(), configuration);
190-
configuration.setBearerToken(tokenResponse.getAccessToken());
191-
192-
ApiClient apiClient = new ApiClient(configuration);
193-
AddressesApi apiInstance = new AddressesApi(apiClient);
194-
String xAvalaraClient = "Swagger UI; 22.7.0; Custom; 1.0"; // String | Identifies the software you are using to call this API. For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) .
195-
AddressValidationInfo body = new AddressValidationInfo(); // AddressValidationInfo | The address to resolve
196-
try {
197-
// SDK will fetch OAuth token using client creds flow with Avalara Identity and append Authorization header to the request with the access token.
198-
AddressResolutionModel result = apiInstance.resolveAddressPost(xAvalaraClient, body);
199-
System.out.println(result);
200-
} catch (ApiException e) {
201-
System.err.println("Exception when calling AddressesApi#resolveAddressPost");
202-
System.err.println("Status code: " + e.getCode());
203-
System.err.println("Reason: " + e.getResponseBody());
204-
System.err.println("Response headers: " + e.getResponseHeaders());
205-
e.printStackTrace();
206-
}
207-
}
208-
}
209-
```
210-
21198
## Recommendation
21299

213100
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
214101

215-
## Author
216-
217102
<a name="documentation-for-api-endpoints"></a>
218103

219104
## Documentation for API Endpoints

0 commit comments

Comments
 (0)