Skip to content

Latest commit

 

History

History
427 lines (338 loc) · 18.2 KB

CustomMetadataApi.md

File metadata and controls

427 lines (338 loc) · 18.2 KB

CustomMetadataApi

All URIs are relative to https://api.phrase.com/v2

Method HTTP request Description
customMetadataPropertiesDelete DELETE /accounts/{account_id}/custom_metadata/properties/{id} Destroy property
customMetadataPropertiesList GET /accounts/{account_id}/custom_metadata/properties List properties
customMetadataPropertyCreate POST /accounts/{account_id}/custom_metadata/properties Create a property
customMetadataPropertyShow GET /accounts/{account_id}/custom_metadata/properties/{id} Get a single property
customMetadataPropertyUpdate PATCH /accounts/{account_id}/custom_metadata/properties/{id} Update a property

customMetadataPropertiesDelete

customMetadataPropertiesDelete(accountId, id, xPhraseAppOTP)

Destroy property

Destroy a custom metadata property of an account. This endpoint is only available to accounts with advanced plans or above.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.CustomMetadataApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    Token.setApiKeyPrefix("token");

    CustomMetadataApi apiInstance = new CustomMetadataApi(defaultClient);
    String accountId = "accountId_example"; // String | Account ID
    String id = "id_example"; // String | ID
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      apiInstance.customMetadataPropertiesDelete(accountId, id, xPhraseAppOTP);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomMetadataApi#customMetadataPropertiesDelete");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
accountId String Account ID
id String ID
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]

Return type

null (empty response body)

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 The resource was deleted successfully. * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

customMetadataPropertiesList

List<CustomMetadataProperty> customMetadataPropertiesList(accountId, xPhraseAppOTP, dataType, projectId, page, perPage, q, sort, order)

List properties

List all custom metadata properties for an account. This endpoint is only available to accounts with advanced plans or above.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.CustomMetadataApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    Token.setApiKeyPrefix("token");

    CustomMetadataApi apiInstance = new CustomMetadataApi(defaultClient);
    String accountId = "accountId_example"; // String | Account ID
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    CustomMetadataDataType dataType = CustomMetadataDataType.fromValue("boolean"); // CustomMetadataDataType | Data Type of Custom Metadata Property
    String projectId = "abcd1234cdef1234abcd1234cdef1234"; // String | id of project that the properties belong to
    Integer page = 1; // Integer | Page number
    Integer perPage = 25; // Integer | Limit on the number of objects to be returned, between 1 and 100. 25 by default
    String q = "character_name"; // String | query to find a property by name
    String sort = "updated_at"; // String | Sort criteria. Can be one of: name, data_type, created_at.
    String order = "desc"; // String | Order direction. Can be one of: asc, desc.
    try {
      List<CustomMetadataProperty> result = apiInstance.customMetadataPropertiesList(accountId, xPhraseAppOTP, dataType, projectId, page, perPage, q, sort, order);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomMetadataApi#customMetadataPropertiesList");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
accountId String Account ID
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]
dataType CustomMetadataDataType Data Type of Custom Metadata Property [optional] [enum: boolean, date, link, multi_select, number, single_select, string, text]
projectId String id of project that the properties belong to [optional]
page Integer Page number [optional]
perPage Integer Limit on the number of objects to be returned, between 1 and 100. 25 by default [optional]
q String query to find a property by name [optional]
sort String Sort criteria. Can be one of: name, data_type, created_at. [optional]
order String Order direction. Can be one of: asc, desc. [optional]

Return type

List<CustomMetadataProperty>

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
* Link -
* Pagination -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

customMetadataPropertyCreate

CustomMetadataProperty customMetadataPropertyCreate(accountId, customMetadataPropertiesCreateParameters, xPhraseAppOTP)

Create a property

Create a new custom metadata property.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.CustomMetadataApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    Token.setApiKeyPrefix("token");

    CustomMetadataApi apiInstance = new CustomMetadataApi(defaultClient);
    String accountId = "accountId_example"; // String | Account ID
    CustomMetadataPropertiesCreateParameters customMetadataPropertiesCreateParameters = new CustomMetadataPropertiesCreateParameters(); // CustomMetadataPropertiesCreateParameters | 
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      CustomMetadataProperty result = apiInstance.customMetadataPropertyCreate(accountId, customMetadataPropertiesCreateParameters, xPhraseAppOTP);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomMetadataApi#customMetadataPropertyCreate");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
accountId String Account ID
customMetadataPropertiesCreateParameters CustomMetadataPropertiesCreateParameters
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]

Return type

CustomMetadataProperty

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
422 Unprocessable entity * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

customMetadataPropertyShow

CustomMetadataProperty customMetadataPropertyShow(accountId, id, xPhraseAppOTP)

Get a single property

Get details of a single custom property.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.CustomMetadataApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    Token.setApiKeyPrefix("token");

    CustomMetadataApi apiInstance = new CustomMetadataApi(defaultClient);
    String accountId = "accountId_example"; // String | Account ID
    String id = "id_example"; // String | ID
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      CustomMetadataProperty result = apiInstance.customMetadataPropertyShow(accountId, id, xPhraseAppOTP);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomMetadataApi#customMetadataPropertyShow");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
accountId String Account ID
id String ID
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]

Return type

CustomMetadataProperty

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

customMetadataPropertyUpdate

CustomMetadataProperty customMetadataPropertyUpdate(accountId, id, customMetadataPropertiesUpdateParameters, xPhraseAppOTP)

Update a property

Update an existing custom metadata property.

Example

// Import classes:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.CustomMetadataApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
    Token.setApiKey("YOUR API KEY");
    Token.setApiKeyPrefix("token");

    CustomMetadataApi apiInstance = new CustomMetadataApi(defaultClient);
    String accountId = "accountId_example"; // String | Account ID
    String id = "id_example"; // String | ID
    CustomMetadataPropertiesUpdateParameters customMetadataPropertiesUpdateParameters = new CustomMetadataPropertiesUpdateParameters(); // CustomMetadataPropertiesUpdateParameters | 
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      CustomMetadataProperty result = apiInstance.customMetadataPropertyUpdate(accountId, id, customMetadataPropertiesUpdateParameters, xPhraseAppOTP);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling CustomMetadataApi#customMetadataPropertyUpdate");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
accountId String Account ID
id String ID
customMetadataPropertiesUpdateParameters CustomMetadataPropertiesUpdateParameters
xPhraseAppOTP String Two-Factor-Authentication token (optional) [optional]

Return type

CustomMetadataProperty

Authorization

Basic, Token

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -