Java

Instructions on how to install and use the MetaCopier API Client package

Create API Key from metacopier.io

To generate yourself an API Key please navigate to metacopier.io > Your Projects > (Choose a project) > API Keys

Note: Please do not share your API Key to people whom you don't trust.

Package Information

The library is based on the following OpenAPI configuration:

Install with Maven

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.metacopier</groupId>
    <artifactId>api</artifactId>
    <version>0.9.0</version>
</dependency>

You can also visit the package on the official Maven Central Repository:

Example Program

Replace the "YOUR_API_KEY" with your own and run the code:

import io.metacopier.AccountApiApi;
import io.metacopier.api.ApiClient;
import io.metacopier.api.ApiException;
import io.metacopier.api.Configuration;
import io.metacopier.api.auth.ApiKeyAuth;
import io.metacopier.client.model.AccountDTO;

import java.util.List;

public class Main {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.metacopier.io");

        // Configure API key authorization: ApiKeyAuth
        ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
        ApiKeyAuth.setApiKey("YOUR_API_KEY");
        AccountApiApi apiInstance = new AccountApiApi(defaultClient);
        
        try {
            List<AccountDTO> results = apiInstance.getAccounts();
            System.out.println(results);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApiApi#createAccount");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }

    }
}

Generate your own package

With the following command, you can generate your own package for the metacopier api:

Be sure that you have installed the OpenAPI Generator. See Generation page for more information.

openapi-generator-cli generate -i https://api.metacopier.io/rest/api/documentation/v3/api-docs -g java

For more information regarding the Open API generator, please visit their offical page:

What endpoints can I call?

To check all available endpoints see either of the two pages:

Readme.ioSwagger

Last updated

Was this helpful?