Webflow API - Reference field not found


Please I am trying to create a new item in a collection.

The name of the collection is Artist - refer to the code below.

Everything about the code works correctly except when the reference field “gallery” is used why creating the item - refer to the code below.

However, if I do not use the reference field, i.e. if I remove the line “gallery”: galleries , things work fine.

The error message that is received when the referenced field is used contains [“Field “gallery”: Field not described in schema”] - which is also shown in the snapshot attached to this post.

Please what can I do to fix this problem?

I need to be able to insert into a reference field while creating a new item in a collection.

I hope it is not that Webflow does not allow writing into a reference field through the API?

Your response/help will be appreciated.


def createArtist(name = “”, slug =“”, location = “”, galleries = “”, authToken):
import http.client
conn = http.client.HTTPSConnection(“api.webflow.com”)
headers = {
‘Accept-Version’: “1.0.0”,
‘Authorization’: authToken,
‘content-type’: “application/json”
payload = {
“fields”: {
“name”: name,
“slug”: slug,
‘_archived’: False,
‘_draft’: False,
‘location-of-gallery’: location,
“gallery”: galleries
payload = json.dumps(payload)
conn.request(“POST”, “/collections/61707513762d547b8160f751/items”, payload , headers)
res = conn.getresponse()
data = res.read()
if res.status == 200:
ret = { “success”: json.loads(data.decode(“utf-8”).replace(“'”, “"”))}
ret = {“error”: data.decode(“utf-8”).replace(“'”, “"”)}
except Exception as e:
ret = {“error”: str(e)}
return ret