Skip to content

Fix add file endpoint code examples #2

@ruflair

Description

@ruflair

The code examples for the add file endpoint are wrong/not working. Right now they are being auto-generated by mintlify.

Broken example from the docs:

`import requests

url = "https://{capsule-id}.sid.ai/data/file"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="metadata"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="time_authored"\r\n\r\n2023-11-07T05:31:56Z\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="uri"\r\n\r\n\r\n-----011000010111000001101001--\r\n\r\n"
headers = {
"Authorization": "Bearer ",
"Content-Type": "multipart/form-data"
}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)`

Working example:

`import requests

url = "https://{capsule-id}.sid.ai/data/file"

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"; filename="file.txt"\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="time_authored"\r\n\r\n2023-11-07T05:31:56Z\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="uri"\r\n\r\nWhat a name\r\n-----011000010111000001101001--\r\n\r\n"
headers = {
"Authorization": "Bearer ",
"Content-Type": "multipart/form-data; boundary=---011000010111000001101001",
}

response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions