The unique identifier for an entity in the Google Ads API is called a
[resource name](https://developers.google.com/google-ads/api/rest/design/resource-names), and is represented as a string with a
predictable format. If you know the constituent IDs of an entity, you can use
the Java client library utilities to generate or parse the full resource name.

## Construct resource names with ResourceNames

The `ResourceNames` utility class constructs the resource name of an entity
when you know all of the relevant IDs related to that entity. For example, a
campaign resource name is in the following format:

    customers/{customer_id}/campaigns/{campaign_id}

If you know the customer ID (without hyphens) and the campaign ID, use the
`ResourceNames` class to construct the full resource name as follows:

    long customerId = 1234567890L;
    long campaignId = 9876543210L;

    String campaignResourceName = ResourceNames.campaign(customerId, campaignId);

You can construct resource names for other entity types as well, which accept
different ID parameters depending on the final form of the resource name.

## Parse resource names

While `ResourceNames` (`com.google.ads.googleads.lib.utils.ResourceNames`) is
version-agnostic across all supported API versions, the Java client library also
provides strongly-typed resource name classes (such as `CampaignName`,
`AdGroupName`, and `CustomerName`) in each versioned resources package (for
example, `com.google.ads.googleads.v26.resources`) that
let you parse a resource name string back into its constituent IDs:

    import com.google.ads.googleads.v26.resources.CampaignName;

    CampaignName campaignName = CampaignName.parse(campaignResourceName);
    String parsedCustomerId = campaignName.getCustomerId();
    String parsedCampaignId = campaignName.getCampaignId();