Is it possible to upload a PDF note attachment via ETAPI? #1007
Replies: 2 comments 3 replies
-
The issue here seems to be some unescaped single quotation marks, which causes parts of the base64 encoded string, that you try to pass as "content", to be parsed as "hostname" by curl. check the "-d" parameter: you start with a single apostrophe, but then you have a second par of (unescaped) single quotation marks for the "content" value
hope that helps :-) |
Beta Was this translation helpful? Give feedback.
-
Trilium-py provides functionality to create attachments. You can refer to the documentation for more details: Trilium-py GitHub Repository. To create an attachment, you can use the following code: res = ea.create_attachment(
ownerId='ViuK7g6K0sWV', # ID of the owner node
file_path=r'E:\test\1.pdf', # Path to the file you want to attach
) In this example:
The result will contain information about the created attachment. |
Beta Was this translation helpful? Give feedback.
-
I have read the ETAPI docs, and API spec, and I am trying the following payload:
Which produces a bunch of errors:
To confirm that this is not an auth or networking issue - the command works fine if instead of the base64 stuff I put in a bit of junk data. Obviously it is not rendered properly, because it is not a pdf, but the attachment is successfully created in trilium.
I'm guessing these are part of the base64 encoded pdf. I am not sure what the issue is, though, perhaps the presence of the file makes the payload too long? I did try using multipart-form, even though it's not in the API spec, but no luck!
Beta Was this translation helpful? Give feedback.
All reactions