Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
The Expert Exam is now live online! Read about the specifics and what it took to bring it to life in the blog by our very own Elizabeth Bonnell!
SOLVED

Get the blob size for a PUT Operation?

Highlighted
Alteryx Partner

When you use the Download tool with an API, and you use the PUT Http verb, you often have to supply the number of bytes of any sent message in the Content-Length header. 

 

If I formulate a JSON data packet, I have to convert to Blob to use with PUT.  I need to add the number of bytes for the blob to the Content-Length header.

 

A browse tool reports the blob length when the blob field is displayed.  How can I get that reported size, so that I can insert the number of bytes in the Content-Length header?  (Note: You cannot just multiply the number of chars by 2, as UTF-8 encoding uses different numbers of bytes for different character sets [https://stackoverflow.com/questions/9761805/calc-utf-8-string-size-in-bytes]).

Highlighted
16 - Nebula
16 - Nebula

Past experience in doing this kind of thing has been to use a blob convert to change the blob into hexadecimal.

 

You can then get the length of the hex (which is 2 characters per bite) and use this as the content-length.

 

Makes the assumption that the blob is already UTF-8 encoded of course.

Highlighted
Alteryx Certified Partner

Hi @Hiblet ,

 

try the "Field Info" tool. This will output the field size of the blob you create.

 

M.

Highlighted
Alteryx Partner

Hi @mceleavey, Sorry, this just returns the field size, like 2Gb, rather than size of the data in the field.  Thanks for the effort though.

Highlighted
Alteryx Partner

Hi @jdunkerley79 , James that is clever, it guarantees 2 chars per byte, so I can imply the byte length reliably.  Many thanks!

Labels