CMDBuild Forum

How to insert a lookup value into a card via REST api

I’ve created a new class that has one attribute defined as a lookup field. Now I’m trying to insert cards to this class via the REST api, but the lookup gets inserted as ‘null’ instead of the value I put in the json.

How can I do this. I’m using python for the prototyping. Here’s a snippet of the (hard) coded stuff I use:

payload = {
“TM_isHeadOffice” : ‘t’,
“TM_isLegalEntity” : ‘t’,
“TM_name” : “Armorica”,
“TM_tradingName” : “Armorica”,
“TM_status” : 1612404
}

r = requests.post(cmdbuild_url, json=payload, headers=headers)

The value in TM_status is a lookup and the value shown is the Id for the value ‘initiated’. I’ve tried a few ways now, but unsuccesful so far. I’m sure I’m missing something, but have been through the docs a few times now without finding a clue.

Any help is appreciated.