All URIs are relative to https://api.rankvectors.com
| Method | HTTP request | Description |
|---|---|---|
| addCredits | POST /api/projects/{projectId}/credits | Add credits |
| getCredits | GET /api/projects/{projectId}/credits | Get credit balance |
AddCredits200Response addCredits(projectId, addCreditsRequest)
Add credits
Add credits to a project (admin or payment webhook use)
// Import classes:
import com.rankvectors.ApiClient;
import com.rankvectors.ApiException;
import com.rankvectors.Configuration;
import com.rankvectors.auth.*;
import com.rankvectors.models.*;
import com.rankvectors.api.CreditsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.rankvectors.com");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
CreditsApi apiInstance = new CreditsApi(defaultClient);
String projectId = "proj-123"; // String | Unique identifier for the project
AddCreditsRequest addCreditsRequest = new AddCreditsRequest(); // AddCreditsRequest |
try {
AddCredits200Response result = apiInstance.addCredits(projectId, addCreditsRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CreditsApi#addCredits");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | String | Unique identifier for the project | |
| addCreditsRequest | AddCreditsRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Credits added successfully | - |
| 400 | Bad request - invalid parameters | - |
| 401 | Unauthorized - missing or invalid API key | - |
| 403 | Forbidden - access denied to resource | - |
| 404 | Not found - resource doesn't exist | - |
| 500 | Internal server error | - |
CreditBalance getCredits(projectId, includeHistory, startDate, endDate)
Get credit balance
Get credit balance and usage history for a project
// Import classes:
import com.rankvectors.ApiClient;
import com.rankvectors.ApiException;
import com.rankvectors.Configuration;
import com.rankvectors.auth.*;
import com.rankvectors.models.*;
import com.rankvectors.api.CreditsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.rankvectors.com");
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
CreditsApi apiInstance = new CreditsApi(defaultClient);
String projectId = "proj-123"; // String | Unique identifier for the project
Boolean includeHistory = false; // Boolean | Include usage history
OffsetDateTime startDate = OffsetDateTime.now(); // OffsetDateTime | History start date (ISO 8601)
OffsetDateTime endDate = OffsetDateTime.now(); // OffsetDateTime | History end date (ISO 8601)
try {
CreditBalance result = apiInstance.getCredits(projectId, includeHistory, startDate, endDate);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CreditsApi#getCredits");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| projectId | String | Unique identifier for the project | |
| includeHistory | Boolean | Include usage history | [optional] [default to false] |
| startDate | OffsetDateTime | History start date (ISO 8601) | [optional] |
| endDate | OffsetDateTime | History end date (ISO 8601) | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Credit balance and usage information | - |
| 401 | Unauthorized - missing or invalid API key | - |
| 403 | Forbidden - access denied to resource | - |
| 404 | Not found - resource doesn't exist | - |
| 500 | Internal server error | - |