Sample Use Cases
The sample use cases provide scenarios to show you how you can use the REST APIs to retrieve or update information. The samples include Java code samples that you can use with the bundled Java client and the Curl call samples for the REST APIs.
The following are the list of sample use cases for the REST APIs:
- •Retrieve the last modified details of an attribute.
- •Retrieve the attribute details of a class.
- •Retrieve objects using object name.
- •Retrieve object details using object ID.
- •Retrieve relationships for columns.
- •Create a custom attribute with specific properties to search for locations based on a ZIP code.
- •Update a custom attribute and custom reference attribute for an object.
- •Update a custom attribute.
- •Create a custom reference attribute that updates a change to the attribute across all the fields where the attribute is associated.
The commands common for all the sample use cases to import the package, included models, HTTP client, and the code to initialize the Java client are provided for reference:
// Copyright (c) 2017 Informatica Corporation. All rights reserved.
package com.infa.products.ldm.ingestion.rest.api.samples;
import com.infa.products.ldm.core.rest.v2.client.api.CatalogApi;
import com.infa.products.ldm.core.rest.v2.client.invoker.ApiException;
import com.infa.products.ldm.core.rest.v2.client.invoker.ApiResponse;
import com.infa.products.ldm.core.rest.v2.client.models.AttributePostRequest;
import com.infa.products.ldm.core.rest.v2.client.models.AttributePutRequest;
import com.infa.products.ldm.core.rest.v2.client.models.AttributeResponse;
import com.infa.products.ldm.core.rest.v2.client.models.AttributesRequest;
import com.infa.products.ldm.core.rest.v2.client.models.AttributesResponse;
import com.infa.products.ldm.core.rest.v2.client.models.FactRequest;
import com.infa.products.ldm.core.rest.v2.client.models.Link;
import com.infa.products.ldm.core.rest.v2.client.models.Links;
import com.infa.products.ldm.core.rest.v2.client.models.ModelRefRequest;
import com.infa.products.ldm.core.rest.v2.client.models.ObjectIdRequest;
import com.infa.products.ldm.core.rest.v2.client.models.ObjectResponse;
import com.infa.products.ldm.core.rest.v2.client.models.ObjectsResponse;
import com.infa.products.ldm.core.rest.v2.client.models.RefAttributePost;
import com.infa.products.ldm.core.rest.v2.client.models.RefAttributesPost;
import com.infa.products.ldm.core.rest.v2.client.models.RefAttributesResponse;
import com.infa.products.ldm.core.rest.v2.client.utils.ObjectAdapter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.squareup.okhttp.CurlLogger;
public class RestSamples {
private final CatalogApi api;
/**
* Initialize the api client. Must be done once before it can be used.
*
* @param username
* @param password
* @param basePath Base URL of rest api ex. http://localhost:8080/access/2
*/
public RestSamples(String username, String password, String basePath) {
this.api = new CatalogApi();
this.api.getApiClient().setUsername(username);
this.api.getApiClient().setPassword(password);
this.api.getApiClient().setBasePath(basePath);
}