Java
Create API Key from metacopier.ioβ
You can use two types of API keys:
- Project-level API key: Navigate to Your Projects > (Choose a project) > API Keys (provides access to all accounts in the project)
- Account API key: Automatically generated when an account is created (provides access only to that specific account). Retrieve using the getAccountApiKeys endpoint.
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:
πhttps://api.metacopier.io/rest/api/documentation/v3/api-docsapi.metacopier.ioInstall with Mavenβ
Add the following dependency to your pom.xml:
<dependency>
<groupId>io.metacopier</groupId>
<artifactId>api</artifactId>
<version>1.2.5</version>
</dependency>
You can also visit the package on the official Maven Central Repository:
πhttps://central.sonatype.com/artifact/io.metacopier/apicentral.sonatype.comExample 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:
info
Be sure that you have installed the OpenAPI Generator.
See generation.md 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:
πhttps://openapi-generator.tech/openapi-generator.techWhat endpoints can I call?β
To check all available endpoints see either of the two pages:
πReadme.ioReadme.io offers a UI similar to Swagger UI for testing the REST API. πSwaggerSwagger UI is a web-based tool that allows developers to interact with and explore RESTful APIs visually. It dynamically generatesβ¦