As shown in some examples I must use lookup column ID when i pass data to Rest API. But I cannot find what the lookup column's id. So How can i add this id to data in rest api?

JSON.stringify({ '__metadata': { 'type': 'SP.Data.FeaturesListItem' }, 
  'SubsystemId':"It will be integer"})

How To insert field of type lookup in the SharePoint List

  • I saw your other question earlier today... when users select the value that you need to translate into a lookup value, presumably they see text, not an integer, and are making their choice based on text. What field in the lookup list is this text from? The Title field? Or some other field? Oct 15, 2020 at 21:25
  • Are you asking for lmy ookup column and its name and subvalues?
    – f_gulay
    Oct 15, 2020 at 21:59
  • It looks like from your code snippet that the list you are trying to write to is called Features, but the lookup column is looking to a different list called Subsystem. I am asking which column from Subsystem is what is providing the text that users see when they go to Features? (Even if Susbsystem is only the name of the column, but the list it looks at is actually named something different, I think you get the point - what is the column from the other list that provides the text values seen in Features?) Oct 15, 2020 at 22:17
  • I have a lookup column in the DocumentMeta list. The column name is GecerliUllke . And this column is linked to another list. The name of this list is UlkeList. One column in UlkeList, connects these two lists and that column is called UlkeKod. So UlkeKod column connects the two lists. I can see it in DocumentMeta as GecerliUlke: UlkeKod. And it can take multiple variables. ???
    – f_gulay
    Oct 15, 2020 at 22:36

1 Answer 1


Ok, based on your answers to some of my questions in the comments, here is how you find the correct integer ID to use when trying to set a lookup column using the REST API.

You said that the lookup column you are trying to set looks at the list UlkeList. In order to set the lookup column, you need to know the list item ID of the specific item you want to link to in the UlkeList list. You also say that the values that are shown in the DocumentMeta list in the lookup column come from the UlkeKod column in the UlkeList list.

I am assuming that when users are choosing what value to set, they are choosing from possible values from the UlkeKod column. (I am also assuming that these are text values, or something that is readable and meaningful to humans, and not more integers.) So in order to get the list item ID of the item in the UlkeList list that has the UlkeKod value selected by the user, you would need to send a REST query like this:

/_api/web/lists/getbytitle('UlkeList')/items?$filter=UlkeKod eq 'Selected UlkeKod value'

Presumably you will only get one result for this query, but because of the way the query is constructed you will still get that single result in a results array. So the data returned from that query will look something like this:

d: {
    results: [
            "Id": 7,
            "ID": 7,
            "Title": "Whatever the title of that item is",
            "UlkeKod": "Selected UlkeKod value",
            // other columns, such as Created, Modified, etc.

This data shows us that (in this pretend example) the item in the UlkeList list that has the UlkeKod column value of "Selected UlkeKod value" is the list item with ID: 7.

That is the integer that you need to use to set the value of the GecerliUlke lookup column in the DocumentMetaList list.

So then you would end up doing something like

var ulkeListItemId = ulkeListResponse.d.results[0].ID

var data = JSON.stringify({
    '__metadata': { 'type': 'SP.Data.DocumentMetaListItem' },
    'GecerliUlkeId': ulkeListItemId

// use that data in your POST to the DocumentMeta list to set the lookup column

Now, in your comments you mention "it can take multiple variables". If what you really mean by that is that the GecerliUlke lookup column allows multiple values, then, as is shown in the example in the other question you linked to, you would need to make the GecerliUlkeId property in your data an object with a results property that is an array of all of the list item IDs of the items in the UlkeList that you want to set as the lookup values:

var data = JSON.stringify({
    '__metadata': { 'type': 'SP.Data.DocumentMetaListItem' },
    'GecerliUlkeId': {
        'results': [

If I have made a mistake in that users are not selecting values from the UlkeKod column when they are making their selections for what to set in the GecerliUlke column, the same general process should apply:

  1. Users select the value(s) that somehow indicate what they want to set in the GecerliUlke column.
  2. You use those selected value(s) to query the UlkeList list to get back the matching list item(s).
  3. You use the item ID(s) in the response from the Ulkelist to set the GecerliUlke column in the DocumentMeta list.
  • You saved my life and saved my day !! Thank you so much. You send this answer very clearly. I finished my task with your support. Thanks! thanks! thanks!
    – f_gulay
    Nov 17, 2020 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.