Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sidnym-ladrut opened this issue Nov 30, 2022 · 0 comments
Open

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

sidnym-ladrut opened this issue Nov 30, 2022 · 0 comments
Assignees

Comments

@sidnym-ladrut
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants