Open
Conversation
BigRoy
requested changes
Feb 26, 2026
Contributor
There was a problem hiding this comment.
import ayon_api
filepath = r"C:\Users\User\Downloads\amazing.json"
print(ayon_api.upload_project_file("test", filepath=filepath))Gives:
Traceback (most recent call last):
File "C:\Users\User\AppData\Roaming\JetBrains\PyCharm2025.3\scratches\ayon_api_upload_project_file.py", line 6, in <module>
print(ayon_api.upload_project_file("test", filepath=filepath))
File "C:\roydev\dev\ayon-python-api\ayon_api\_api.py", line 1022, in upload_project_file
return con.upload_project_file(
File "C:\roydev\dev\ayon-python-api\ayon_api\server_api.py", line 1546, in upload_project_file
return self.upload_file(
File "C:\roydev\dev\ayon-python-api\ayon_api\server_api.py", line 1862, in upload_file
return self.upload_file_from_stream(
File "C:\roydev\dev\ayon-python-api\ayon_api\server_api.py", line 1813, in upload_file_from_stream
return self._upload_file(
File "C:\roydev\dev\ayon-python-api\ayon_api\server_api.py", line 1769, in _upload_file
response.raise_for_status()
File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://127.0.0.1:5000/api/projects/test/filesServer creates logs:
2026-02-26 21:40:29 ERROR api.server | Request validation error in [POST] /api/projects/test/files
2026-02-26 21:40:29 traceback:
2026-02-26 21:40:29 x-file-name: field required
Hence the lack of the x-file-name header is the issue?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
Add helper methods for project file upload.
Additional information
Noticed we have download but not upload. Idea came from community question asking why
upload_filedoes not work, and it is because the endpoint expects to usePOSTmethod instead ofPUT.Testing notes: