Skip to content

avadev/Avalara-SDK-Java

Repository files navigation

Avalara.SDK - the Unified Java SDK for next gen Avalara services.

Unified SDK consists of services on top of which the Avalara Compliance Cloud platform is built. These services are foundational and provide functionality such as einvoicing.

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>net.avalara</groupId>
  <artifactId>avalara-sdk</artifactId>
  <version>24.12.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
  mavenCentral()
  mavenLocal()
}

dependencies {
  implementation 'net.avalara:avalara-sdk:24.12.0'
}

Getting Started

Please follow the installation instruction and execute the following Java code:

import Avalara.SDK.*;
import Avalara.SDK.api.EInvoicing.V1.*;
import Avalara.SDK.model.EInvoicing.V1.*;

public class MandatesApiExample {

  public static void main(String[] args) {
      Configuration configuration = new Configuration();
      configuration.setAppName("Test");
      configuration.setAppVersion("1.0");
      configuration.setMachineName("LocalBox");
      configuration.setTimeout(5000);
      configuration.setEnvironment(AvaTaxEnvironment.Sandbox);
      // Configure OAuth2 access token for authorization
      configuration.setBearerToken("YOUR ACCESS TOKEN");

      try {
          ApiClient apiClient = new ApiClient(configuration);
          Avalara.SDK.api.EInvoicing.V1.MandatesApi apiInstance = new MandatesApi(apiClient);
          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/) .
          MandatesApi.GetMandatesRequest request = apiInstance.getGetMandatesRequest();
          request.setXAvalaraClient(xAvalaraClient);
          MandatesResponse result = apiInstance.getMandates(request);
          System.out.println(result);
      } catch (ApiException e) {
          System.err.println("Exception when calling MandatesAPI#getMandates");
          System.err.println("Status code: " + e.getCode());
          System.err.println("Reason: " + e.getResponseBody());
          System.err.println("Response headers: " + e.getResponseHeaders());
          e.printStackTrace();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
}

Recommendation

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

Documentation for API Endpoints

EInvoicing V1 API Documentation

Class Method HTTP request Description
DataInputFieldsApi getDataInputFields GET /data-input-fields Returns the optionality of document fields for different country mandates
DocumentsApi downloadDocument GET /documents/{documentId}/$download Returns a copy of the document
DocumentsApi fetchDocuments POST /documents/$fetch Fetch the inbound document from a tax authority
DocumentsApi getDocumentList GET /documents Returns a summary of documents for a date range
DocumentsApi getDocumentStatus GET /documents/{documentId}/status Checks the status of a document
DocumentsApi submitDocument POST /documents Submits a document to Avalara E-Invoicing API
InteropApi submitInteropDocument POST /interop/documents Submit a document
MandatesApi getMandateDataInputFields GET /mandates/{mandateId}/data-input-fields Returns document field information for a country mandate, a selected document type, and its version
MandatesApi getMandates GET /mandates List country mandates that are supported by the Avalara E-Invoicing platform
SubscriptionsApi createWebhookSubscription POST /webhooks/subscriptions Create a subscription to events
SubscriptionsApi deleteWebhookSubscription DELETE /webhooks/subscriptions/{subscription-id} Unsubscribe from events
SubscriptionsApi getWebhookSubscription GET /webhooks/subscriptions/{subscription-id} Get details of a subscription
SubscriptionsApi listWebhookSubscriptions GET /webhooks/subscriptions List all subscriptions
TradingPartnersApi batchSearchParticipants POST /trading-partners/batch-searches Creates a batch search and performs a batch search in the directory for participants in the background.
TradingPartnersApi downloadBatchSearchReport GET /trading-partners/batch-searches/{id}/$download-results Download batch search results in a csv file.
TradingPartnersApi getBatchSearchDetail GET /trading-partners/batch-searches/{id} Get the batch search details for a given id.
TradingPartnersApi listBatchSearches GET /trading-partners/batch-searches List all batch searches that were previously submitted.
TradingPartnersApi searchParticipants GET /trading-partners Returns a list of participants matching the input query.

A1099 V2 API Documentation

Class Method HTTP request Description
CompaniesW9Api createCompany POST /w9/companies Creates a new company
CompaniesW9Api deleteCompany DELETE /w9/companies/{id} Deletes a company
CompaniesW9Api getCompanies GET /w9/companies List companies
CompaniesW9Api getCompany GET /w9/companies/{id} Retrieve a company
CompaniesW9Api updateCompany PUT /w9/companies/{id} Update a company
Forms1099Api bulkUpsert1099Forms POST /1099/forms/$bulk-upsert Creates or updates multiple 1099 forms.
Forms1099Api create1099Form POST /1099/forms Creates a 1099 form.
Forms1099Api delete1099Form DELETE /1099/forms/{id} Deletes a 1099 form.
Forms1099Api get1099Form GET /1099/forms/{id} Retrieves a 1099 form.
Forms1099Api get1099FormPdf GET /1099/forms/{id}/pdf Retrieves the PDF file for a single 1099 by form id.
Forms1099Api list1099Forms GET /1099/forms Retrieves a list of 1099 forms based on query parameters.
Forms1099Api update1099Form PUT /1099/forms/{id} Updates a 1099 form.
FormsW9Api createW9Form POST /w9/forms Create a W9/W4/W8 form
FormsW9Api deleteW9Form DELETE /w9/forms/{id} Delete a form
FormsW9Api getW9Form GET /w9/forms/{id} Retrieve a W9/W4/W8 form
FormsW9Api getW9FormRequest GET /w9/forms/requests/{formRequestId} Retrieve a form request
FormsW9Api listW9Forms GET /w9/forms List W9/W4/W8 forms.
FormsW9Api sendW9FormEmail POST /w9/forms/{id}/$send-email Sends a W9 email request to a vendor/payee
FormsW9Api updateW9Form PUT /w9/forms/{id} Update a W9/W4/W8 form
FormsW9Api uploadW9Files PUT /w9/forms/{id}/attachment Upload files for a W9/W4/W8 form
Issuers1099Api createIssuer POST /1099/issuers Create an issuer
Issuers1099Api deleteIssuer DELETE /1099/issuers/{id} Delete an issuer
Issuers1099Api getIssuer GET /1099/issuers/{id} Get an issuer
Issuers1099Api getIssuers GET /1099/issuers List issuers
Issuers1099Api updateIssuer PUT /1099/issuers/{id} Update an issuer
Jobs1099Api getJob GET /1099/jobs/{id} Retrieves information about the job

Documentation for Models

EInvoicing V1 Model Documentation

A1099 V2 Model Documentation

About

Avalara-SDK-Java

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages