All documentation for the REST API states that Lookup Fields are not available for record creation or update. Is there any way to get around this limitation? Lookups appear to be the only way to relate records between apps. If I wanted to create a record in an app and have it relate to another record is there anyway to do that with the API?
Hi Scott,
The following post will help you update the lookup field automatically.
https://developer.kintone.io/hc/en-us/community/posts/220307528-Look-up-source-fields-not-updating
Once a new lookup field record is created at the source app, you should be able to see the new one at the destination app without API.
“Related Records field” also shows the record(s) that match the condition you specify from the same or another app.
Here is the info about the field.
▼ What is “Related Records”?
https://jp.cybozu.help/en/k/user/whats_relatedrecords
Thank you.
Junko
Correct me if I’m reading the following post: (https://developer.kintone.io/hc/en-us/community/posts/220307528-Look-up-source-fields-not-updating) wrong but that has to do with updating mapped fields (from the source app) in an already established connection between the source and destination app.
Is there anyway in a new record or update record (at the destination app) to specify the record in the source app to the destination app?
> Lookups appear to be the only way to relate records between apps.
Yes, I agree.
> If I wanted to create a record in an app and have it relate to another record is there anyway to do that with the API?
I think lookup is one of the best choices.
> Is there any way to get around this limitation?
When you create/update the records that have lookup fields using REST API, you have only to specify the key field of lookup(not copied fields). But there are two important points.
Did you check “Field Requests/Lookup” in the Field Types documentation? It says “Creating/updating of Lookup fields cannot be initiated with API tokens. The “Prohibit duplicate values” option must be checked for the Datasource App’s key field”, but they are frequently forgotten.
Thank you Junko and Ryu,
I finally realized the issue from your post. The API authentication I was using was the API Token and not the API user auth based on the Base64 encoding. Once I changed the REST API authentication process from token to user, it worked.