REST API Returns Unexpected ID Format for a Lookup
search cancel

REST API Returns Unexpected ID Format for a Lookup

book

Article ID: 383480

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

You are getting an unexpected ID format (such as the 5xxxxxx internal ID) when using the REST API to request the values of a Lookup, instead of the external ID.

GET <server>/ppm/rest/v1/lookups/<lookup>/lookupValues:

[...]
    "_results": [
        {
            "displayValue": "Value",
            "id": 5000001,
            "_self": "<server>/ppm/rest/v1/lookups/<lookup>/lookupValues/5000001"
        },
[...]

Environment

Any supported Clarity release.

Cause

The Lookup Hidden Key is set to "id" (Classic Administration > Data Administration > Lookups > [Lookup] > Parent Window > Hidden Key).

Resolution

As the Hidden Key is an Enter Once value, create a new Lookup with the desired Hidden Key.

In order to be able to use the Lookup in the REST API, it will also be necessary to create an Attribute with an API Alias that uses that Lookup. The REST API endpoint will still require the Lookup ID, not the Attribute API Alias.