Developer-friendly & type-safe Java SDK specifically catered to leverage openapi API.
Apideck: The Apideck OpenAPI Spec: SDK Optimized
For more information about the API: Apideck Developer Docs
JDK 11 or later is required.
The samples below show how a published SDK artifact is used:
Gradle:
implementation 'com.apideck:unify:0.2.0'
Maven:
<dependency>
<groupId>com.apideck</groupId>
<artifactId>unify</artifactId>
<version>0.2.0</version>
</dependency>
After cloning the git repository to your file system you can build the SDK artifact from source to the build
directory by running ./gradlew build
on *nix systems or gradlew.bat
on Windows systems.
If you wish to build from source and publish the SDK artifact to your local Maven repository (on your filesystem) then use the following command (after cloning the git repo locally):
On *nix:
./gradlew publishToMavenLocal -Pskip.signing
On Windows:
gradlew.bat publishToMavenLocal -Pskip.signing
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.TaxRatesFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingTaxRatesAllRequest;
import com.apideck.unify.models.operations.AccountingTaxRatesAllResponse;
import java.lang.Exception;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
AccountingTaxRatesAllRequest req = AccountingTaxRatesAllRequest.builder()
.serviceId("salesforce")
.filter(TaxRatesFilter.builder()
.assets(true)
.equity(true)
.expenses(true)
.liabilities(true)
.revenue(true)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
AccountingTaxRatesAllResponse res = sdk.accounting().taxRates().list()
.request(req)
.call();
if (res.getTaxRatesResponse().isPresent()) {
// handle response
}
}
}
Available methods
- list - List Attachments
- get - Get Attachment
- delete - Delete Attachment
- download - Download Attachment
- get - Get BalanceSheet
- list - List Bill Payments
- create - Create Bill Payment
- get - Get Bill Payment
- update - Update Bill Payment
- delete - Delete Bill Payment
- get - Get company info
- list - List Credit Notes
- create - Create Credit Note
- get - Get Credit Note
- update - Update Credit Note
- delete - Delete Credit Note
- list - List Customers
- create - Create Customer
- get - Get Customer
- update - Update Customer
- delete - Delete Customer
- list - List Departments
- create - Create Department
- get - Get Department
- update - Update Department
- delete - Delete Department
- list - List Expenses
- create - Create Expense
- get - Get Expense
- update - Update Expense
- delete - Delete Expense
- list - List Invoice Items
- create - Create Invoice Item
- get - Get Invoice Item
- update - Update Invoice Item
- delete - Delete Invoice Item
- list - List Invoices
- create - Create Invoice
- get - Get Invoice
- update - Update Invoice
- delete - Delete Invoice
- list - List Journal Entries
- create - Create Journal Entry
- get - Get Journal Entry
- update - Update Journal Entry
- delete - Delete Journal Entry
- list - List Ledger Accounts
- create - Create Ledger Account
- get - Get Ledger Account
- update - Update Ledger Account
- delete - Delete Ledger Account
- list - List Locations
- create - Create Location
- get - Get Location
- update - Update Location
- delete - Delete Location
- list - List Payments
- create - Create Payment
- get - Get Payment
- update - Update Payment
- delete - Delete Payment
- get - Get Profit and Loss
- list - List Purchase Orders
- create - Create Purchase Order
- get - Get Purchase Order
- update - Update Purchase Order
- delete - Delete Purchase Order
- list - List Subsidiaries
- create - Create Subsidiary
- get - Get Subsidiary
- update - Update Subsidiary
- delete - Delete Subsidiary
- list - List Suppliers
- create - Create Supplier
- get - Get Supplier
- update - Update Supplier
- delete - Delete Supplier
- list - List Tax Rates
- create - Create Tax Rate
- get - Get Tax Rate
- update - Update Tax Rate
- delete - Delete Tax Rate
- list - List Tracking Categories
- create - Create Tracking Category
- get - Get Tracking Category
- update - Update Tracking Category
- delete - Delete Tracking Category
- list - List Applicants
- create - Create Applicant
- get - Get Applicant
- update - Update Applicant
- delete - Delete Applicant
- list - List Applications
- create - Create Application
- get - Get Application
- update - Update Application
- delete - Delete Application
- get - Get API Resource Coverage
- get - Get API Resource
- get - Get Connector Doc content
- get - Get Connector Resource
- list - List activities
- create - Create activity
- get - Get activity
- update - Update activity
- delete - Delete activity
- list - List companies
- create - Create company
- get - Get company
- update - Update company
- delete - Delete company
- list - List contacts
- create - Create contact
- get - Get contact
- update - Update contact
- delete - Delete contact
- list - List opportunities
- create - Create opportunity
- get - Get opportunity
- update - Update opportunity
- delete - Delete opportunity
- list - List pipelines
- create - Create pipeline
- get - Get pipeline
- update - Update pipeline
- delete - Delete pipeline
- get - Get Store
- list - List DriveGroups
- create - Create DriveGroup
- get - Get DriveGroup
- update - Update DriveGroup
- delete - Delete DriveGroup
- list - List Drives
- create - Create Drive
- get - Get Drive
- update - Update Drive
- delete - Delete Drive
- list - List Files
- search - Search Files
- get - Get File
- update - Rename or move File
- delete - Delete File
- download - Download File
- export - Export File
- create - Create Folder
- get - Get Folder
- update - Rename or move Folder
- delete - Delete Folder
- copy - Copy Folder
- list - List SharedLinks
- create - Create Shared Link
- get - Get Shared Link
- update - Update Shared Link
- delete - Delete Shared Link
- create - Start Upload Session
- get - Get Upload Session
- delete - Abort Upload Session
- finish - Finish Upload Session
- list - List Companies
- create - Create Company
- get - Get Company
- update - Update Company
- delete - Delete Company
- list - List Departments
- create - Create Department
- get - Get Department
- update - Update Department
- delete - Delete Department
- list - List Employees
- create - Create Employee
- get - Get Employee
- update - Update Employee
- delete - Delete Employee
- list - List Employee Schedules
- list - List Time Off Requests
- create - Create Time Off Request
- get - Get Time Off Request
- update - Update Time Off Request
- delete - Delete Time Off Request
- list - List Tags
- list - List Comments
- create - Create Comment
- get - Get Comment
- update - Update Comment
- delete - Delete Comment
- list - List Tickets
- create - Create Ticket
- get - Get Ticket
- update - Update Ticket
- delete - Delete Ticket
- list - List Messages
- create - Create Message
- get - Get Message
- update - Update Message
- delete - Delete Message
- list - List connection custom mappings
- list - Get all connections
- get - Get connection
- update - Update connection
- delete - Deletes a connection
- imports - Import connection
- token - Authorize Access Token
- list - Consumer request counts
- create - Create consumer
- list - Get all consumers
- get - Get consumer
- update - Update consumer
- delete - Delete consumer
- state - Create Callback State
- list - Get resource custom fields
- list - List custom mappings
- list - Get all consumer request logs
- create - Create Session
- state - Validate Connection State
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, you can provide a RetryConfig
object through the retryConfig
builder method:
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.TaxRatesFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingTaxRatesAllRequest;
import com.apideck.unify.models.operations.AccountingTaxRatesAllResponse;
import com.apideck.unify.utils.BackoffStrategy;
import com.apideck.unify.utils.RetryConfig;
import java.lang.Exception;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
AccountingTaxRatesAllRequest req = AccountingTaxRatesAllRequest.builder()
.serviceId("salesforce")
.filter(TaxRatesFilter.builder()
.assets(true)
.equity(true)
.expenses(true)
.liabilities(true)
.revenue(true)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
AccountingTaxRatesAllResponse res = sdk.accounting().taxRates().list()
.request(req)
.retryConfig(RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(1L, TimeUnit.MILLISECONDS)
.maxInterval(50L, TimeUnit.MILLISECONDS)
.maxElapsedTime(1000L, TimeUnit.MILLISECONDS)
.baseFactor(1.1)
.jitterFactor(0.15)
.retryConnectError(false)
.build())
.build())
.call();
if (res.getTaxRatesResponse().isPresent()) {
// handle response
}
}
}
If you'd like to override the default retry strategy for all operations that support retries, you can provide a configuration at SDK initialization:
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.TaxRatesFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingTaxRatesAllRequest;
import com.apideck.unify.models.operations.AccountingTaxRatesAllResponse;
import com.apideck.unify.utils.BackoffStrategy;
import com.apideck.unify.utils.RetryConfig;
import java.lang.Exception;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.retryConfig(RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(1L, TimeUnit.MILLISECONDS)
.maxInterval(50L, TimeUnit.MILLISECONDS)
.maxElapsedTime(1000L, TimeUnit.MILLISECONDS)
.baseFactor(1.1)
.jitterFactor(0.15)
.retryConnectError(false)
.build())
.build())
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
AccountingTaxRatesAllRequest req = AccountingTaxRatesAllRequest.builder()
.serviceId("salesforce")
.filter(TaxRatesFilter.builder()
.assets(true)
.equity(true)
.expenses(true)
.liabilities(true)
.revenue(true)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
AccountingTaxRatesAllResponse res = sdk.accounting().taxRates().list()
.request(req)
.call();
if (res.getTaxRatesResponse().isPresent()) {
// handle response
}
}
}
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.
By default, an API error will throw a models/errors/APIException
exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the list
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
models/errors/BadRequestResponse | 400 | application/json |
models/errors/UnauthorizedResponse | 401 | application/json |
models/errors/PaymentRequiredResponse | 402 | application/json |
models/errors/NotFoundResponse | 404 | application/json |
models/errors/UnprocessableResponse | 422 | application/json |
models/errors/APIException | 4XX, 5XX | */* |
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.TaxRatesFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingTaxRatesAllRequest;
import com.apideck.unify.models.operations.AccountingTaxRatesAllResponse;
import java.lang.Exception;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
AccountingTaxRatesAllRequest req = AccountingTaxRatesAllRequest.builder()
.serviceId("salesforce")
.filter(TaxRatesFilter.builder()
.assets(true)
.equity(true)
.expenses(true)
.liabilities(true)
.revenue(true)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
AccountingTaxRatesAllResponse res = sdk.accounting().taxRates().list()
.request(req)
.call();
if (res.getTaxRatesResponse().isPresent()) {
// handle response
}
}
}
The default server can also be overridden globally using the .serverURL(String serverUrl)
builder method when initializing the SDK client instance. For example:
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.TaxRatesFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingTaxRatesAllRequest;
import com.apideck.unify.models.operations.AccountingTaxRatesAllResponse;
import java.lang.Exception;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.serverURL("https://unify.apideck.com")
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
AccountingTaxRatesAllRequest req = AccountingTaxRatesAllRequest.builder()
.serviceId("salesforce")
.filter(TaxRatesFilter.builder()
.assets(true)
.equity(true)
.expenses(true)
.liabilities(true)
.revenue(true)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
AccountingTaxRatesAllResponse res = sdk.accounting().taxRates().list()
.request(req)
.call();
if (res.getTaxRatesResponse().isPresent()) {
// handle response
}
}
}
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.CreateUploadSessionRequest;
import com.apideck.unify.models.components.ExtendPaths;
import com.apideck.unify.models.components.PassThroughBody;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.FileStorageUploadSessionsAddRequest;
import com.apideck.unify.models.operations.FileStorageUploadSessionsAddResponse;
import java.lang.Exception;
import java.util.List;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
FileStorageUploadSessionsAddRequest req = FileStorageUploadSessionsAddRequest.builder()
.createUploadSessionRequest(CreateUploadSessionRequest.builder()
.name("Documents")
.parentFolderId("1234")
.size(1810673L)
.driveId("1234")
.passThrough(List.of(
PassThroughBody.builder()
.serviceId("<id>")
.extendPaths(List.of(
ExtendPaths.builder()
.path("$.nested.property")
.value(Map.ofEntries(\n Map.entry("TaxClassificationRef", Map.ofEntries(\n Map.entry("value", "EUC-99990201-V1-00020000")))))
.build()))
.build()))
.build())
.serviceId("salesforce")
.build();
FileStorageUploadSessionsAddResponse res = sdk.fileStorage().uploadSessions().create()
.request(req)
.serverURL("https://upload.apideck.com")
.call();
if (res.createUploadSessionResponse().isPresent()) {
// handle response
}
}
}
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
apiKey |
apiKey | API key |
To authenticate with the API the apiKey
parameter must be set when initializing the SDK client instance. For example:
package hello.world;
import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.TaxRatesFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingTaxRatesAllRequest;
import com.apideck.unify.models.operations.AccountingTaxRatesAllResponse;
import java.lang.Exception;
import java.util.Map;
public class Application {
public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {
Apideck sdk = Apideck.builder()
.apiKey("<YOUR_API_KEY_HERE>")
.consumerId("test-consumer")
.appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
.build();
AccountingTaxRatesAllRequest req = AccountingTaxRatesAllRequest.builder()
.serviceId("salesforce")
.filter(TaxRatesFilter.builder()
.assets(true)
.equity(true)
.expenses(true)
.liabilities(true)
.revenue(true)
.build())
.passThrough(Map.ofEntries(
Map.entry("search", "San Francisco")))
.fields("id,updated_at")
.build();
AccountingTaxRatesAllResponse res = sdk.accounting().taxRates().list()
.request(req)
.call();
if (res.getTaxRatesResponse().isPresent()) {
// handle response
}
}
}
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.