Skip to content

getdyspatch/dyspatch-java

Repository files navigation

dyspatch-java

Dyspatch API

  • API version: 2020.11

Introduction

The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our Implementation Guide for more details on how to implement Dyspatch.

API Client Libraries

Dyspatch provides API Clients for popular languages and web frameworks.

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  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>io.dyspatch</groupId>
  <artifactId>dyspatch-java</artifactId>
  <version>7.0.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.dyspatch:dyspatch-java:7.0.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/dyspatch-java-7.0.0.jar
  • target/lib/*.jar

Getting Started

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

// Import classes:
import io.dyspatch.client.ApiClient;
import io.dyspatch.client.ApiException;
import io.dyspatch.client.Configuration;
import io.dyspatch.client.auth.*;
import io.dyspatch.client.models.*;
import io.dyspatch.client.api.DraftsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.dyspatch.io");
    
    // Configure API key authorization: Bearer
    ApiKeyAuth Bearer = (ApiKeyAuth) defaultClient.getAuthentication("Bearer");
    Bearer.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //Bearer.setApiKeyPrefix("Token");

    DraftsApi apiInstance = new DraftsApi(defaultClient);
    String draftId = "draftId_example"; // String | A draft ID
    String languageId = "languageId_example"; // String | A language ID (eg: en-US)
    String accept = "accept_example"; // String | A version of the API that should be used for the request. For example, to use version \"2020.11\", set the value to \"application/vnd.dyspatch.2020.11+json\"
    try {
      apiInstance.deleteLocalization(draftId, languageId, accept);
    } catch (ApiException e) {
      System.err.println("Exception when calling DraftsApi#deleteLocalization");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Documentation for API Endpoints

All URIs are relative to https://api.dyspatch.io

Class Method HTTP request Description
DraftsApi deleteLocalization DELETE /drafts/{draftId}/localizations/{languageId} Remove a localization
DraftsApi getDraftById GET /drafts/{draftId} Get Draft by ID
DraftsApi getDraftLocalizationKeys GET /drafts/{draftId}/localizationKeys Get localization keys
DraftsApi getDrafts GET /drafts List Drafts
DraftsApi getLocalizationForDraft GET /drafts/{draftId}/localizations Get localizations on a draft
DraftsApi saveLocalization PUT /drafts/{draftId}/localizations/{languageId} Create or update a localization
DraftsApi setTranslation PUT /drafts/{draftId}/localizations/{languageId}/translations Set translations for language
DraftsApi submitDraftForApproval POST /drafts/{draftId}/publishRequest Submit the draft for approval
LocalizationsApi getLocalizationById GET /localizations/{localizationId} Get Localization Object by ID
TemplatesApi getTemplateById GET /templates/{templateId} Get Template by ID
TemplatesApi getTemplates GET /templates List Templates

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

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

Author

support@dyspatch.io

About

An OpenAPI generated Dyspatch client in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published