Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Get Statement Image Data

I have implemented a service call to access the q2_sdk.hq.hq_api.q2_api.GetStatementImage endpoint for the user to retrieve their statement. My question is regarding the actual data returned.

The image_type is defined as 'PDF' and the data returned was a very long string. Following the documentation provided https://docs.q2developer.com/guides/online_integration/file_uploads.html, I attempted to upload the image_data via the Python method but I got an error from the log stating, [Errno 36] File name too long. I made sure that I passed the image_data to the data parameter, but I'm getting this error still.

Is there a step that I missed with handling the image data returned?

Posted one year ago
Votes Newest

Answers


According to the documentation here: https://docs.q2developer.com/api_references/q2_sdk/ardent/index.html#q2_sdk.ardent.file_upload.File.upload_from_file
The data parameter either takes a BytesIO object or a string, but it specifies that the string is a path to a file not the file itself. If the data is a string datatype then you need to convert it to a BytesIO object.

-Trey

Posted one year ago
Trey Teter
489 × 4 Administrator
0

That makes sense I need to convert the data into a BytesIO object. But since the image data returned is a string because it was part of the response from GetStatementImage, what I want to know now is what type of data is the string suppose to represent. And would I need to convert the string back to it's original type before the upload process. The intention is to display the statement image in PDF. Currently, I'm able to upload the data and get a download url but I'm getting a "Failed to load PDF Document" error when opening it.

— Kyle Chiu   one year ago
0

For anyone who wants to know, the data returned is expected to be a based64 encoded binary PDF file.

— Kyle Chiu   one year ago