Skip to content

Cannot Update Tags via api/v3/update-file Endpoint #1154

Open
@sidnym-ladrut

Description

@sidnym-ladrut

Purpose

While other fields of a file can be modified through Slate's api/v3/update-file endpoint, the "tags" field remains seemingly immutable. The following is a demonstration in Python, which fails the last contained assertion (i.e. that the returned object after a successful POST has the same number of tags as the submitted object):

import requests
import json as JSON

headers = {
    "content-type": "application/json",
    "Authorization": "", # API key
}

r1 = requests.get(
    "https://slate.host/api/v3/get",
    headers=headers,
)
data = r1.json()
objs = data["collections"][0]["objects"]

mobj = objs[0]
mobj["tags"].append({
    "id": "", # Existing Tag ID
    "name": "", # Existing Tag Name
    "slatename": "", # Existing Tag Slate-name
})

r2 = requests.post(
    "https://slate.host/api/v3/update-file",
    headers=headers,
    json={"data": mobj},
)
assert r2.status_code == 200, "malformatted request"
nobj = r2.json()["file"]
assert len(nobj["tags"]) == len(mobj["tags"]), "update failed"

Deliverable

The tags field should be modifiable through the api/v3/update-file endpoint like the other file fields.

Dependencies

N/A

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions