Specifying response format to Binary or OctetStream in Apigee Service callout - apigee

I am calling Soap API in Apigee service callout which returns xml with attachments. In Apigee is their a way to specify how to read the response as binary or octet stream. Because Apigee by default is converting the response to UTF-8. Because of this when I convert the attachment to base64 string and generate the PDF out of the base64 string it returns the blank pdf.
Basically, I want to address the issue which is similar to in this link https://www.linkedin.com/pulse/converting-pdf-binary-base64-nodejs-trick-end-andrew-ribeiro

Related

How to decode SAML?

I would decode this message sent to our national tax office. I have no clue how to start it. Seems it is a SAML encoding, I do not know much about SAML.
But in the content either xml or json is.
I tried this website to decode, but it did not do it.
https://www.samltool.com/decode.php
How to decode?
The HTTP-Redirect binding uses the DEFLATE encoding. The SAML message has been sent using the HTTP-Post binding. This means that the form data will include either a SAMLRequest or SAMLResponse form variable. This form variable must first be URL-decoded and then base-64 decoded to get the resultant XML.

Example of HTTP body for URL Encoded HTTP Request from Twilio Studio

I am trying to POST with URL encoded data. Based on the web server logs, I am not actually sending any data from Twilio (request size is always 131 bytes, no matter what I type in the Studio widget box).
What does a working form body look like? Do I need to encode it myself? How do I escape an "=" that is not part of the key-value structure?
When making an HTTP request with the widget, when it is set to make Form URL encoded requests you can set the HTTP parameter keys and values which will automatically encode the values. There are known as URL parameter as the encoding is Form URL encoding. The parameters are encoded as if they were in a URL, but they are sent as the POST body.

How to send a post request to a specific URI from PowerApps?

I am looking for a way to send a post request to a specific URI from PowerApps.
Basically I have a small audio file (webm) captured from the microphone and it's encoded using Base64. Now I have to send it to a server via post request and the encoded data should be put in the body of the request, since it is too big (for Nginx) to be put in the URL itself (?data=).
Can I achieve it in PowerApps?
Binary to encoded text (in PowerApps):
Set(BinaryAudioData_2, Substitute(JSON(Mic2.Audio,JSONFormat.IncludeBinaryData),"""",""));
Set(AudioFile, Mic2.Audio); Collect(Collection3, AudioFile);
You can trigger a Power Automate Flow from PowerApps, then Flow can target the specific URI. Read more

Route Match API: Zipping and Encoding

I'm trying to use the HERE route match API, and I'm confused about the file parameter when attempting to use the GET interface. The API for the file parameter states:
Base64 encoded string that contains the (zipped or plain) trace file
content. Zipped can be PKZip (used by zip, WinZip, 7Zip etc) or ZLib
(used by deflate) format. Only used for GET requests. In POST
requests, the file is sent as request body, not Base64 encoded, plain
or zipped. Note: Browsers limit the size of the file to a few KB when
passed in a GET request.
I've chosen to use the GPX format for my waypoints. Questions:
What is the required character encoding of the underlying XML
characters when sending plain or zipped trace file content?
Are there specifications for the compression method (Deflate, Deflate64,
etc.) and compression level?
Are there required specifications for
the type of base64 encoding?
I can definitively answer #3, and that requires URL safe encoding.

HMAC authenticated API calls with multipart/form-data file uploads

We have an existing API where 3rd parties can push data. The API calls are authenticated with HMAC using the same scheme as described in Ruby's ApiAuth library which I use to verify signed requests. We now need to support multipart/form-data file uploads.
I'm attempting to write a bash script as an example API call using cURL. I already have one that works without file uploads (POST request with only JSON data) here.
The part I'm stuck on is generating the $content_md5 for the multipart request. I understand the content of a multipart request has content sections separated by the boundary string, as described here.
Problem 1: cURL generates it's own boundary string and appends it to my content-type header
Problem 2: Should I MD5 the entire request body with boundary strings and section headers included?
So basically, I need to be able to know what the boundary string is so that I can generate a string that looks like the content sections and boundaries described in the http multipart format, lines 7 through 23 so that I may MD5 it.
Is there a way to do this with only cURL? Is there a better way to construct such an HMAC signed multipart request?
I was hoping to do it with cURL to present as a generalized example to 3rd party devs that will integrate with our API so they can sign their requests in whatever language they're using.

Resources