[ardoHTTP] Please add support for Binary
Forge component by Ricardo Silva


I currently creating an component to work with the Microsoft Graph API for SharePoint. One of the features is uploading a file via an UploadSession. The problem with this is, is that instead that the upload is handled via Microsoft Graph (https://microsoft.graph.com/...) the uploadsession is handled directly with the SharePoint tenant in question, example: "https://<tenant>.sharepoint.com/sites/...". This prevents me from using the default REST in OutSystems because I can't define a complete URL, I already need to know the root (and yes, you can change that in ServiceCenter but if you have multiple tenants like us that possibility is not the solution). 

I could to create my own version of this request but this is very useful and I think it should be in the base pacakge. I opened the package and I think that it's real easy to add this since it requires only changes in the called function. I added the resulting function below for the PUT operation. 

public void MssHTTPPutBinary(string ssURL, RLHTTPHeaderRecordList ssHeaders, byte[] ssData, string ssContent_Type, string ssUsername, string ssPassword, out string ssStatus, out int ssStatus_Code, out string ssResponse, out RLHTTPHeaderBinaryRecordList ssResponse_Headers)
            ssStatus = "";
            ssStatus_Code = 0;
            ssResponse = "";
            ssResponse_Headers = new RLHTTPHeaderRecordList();

            if (ssContent_Type != "")
                RCHTTPHeaderRecord ct_header = new RCHTTPHeaderRecord(null);
                ct_header.ssSTHTTPHeader.ssName = "Content-Type";
                ct_header.ssSTHTTPHeader.ssValue = ssContent_Type;

            processResponse(processRequest("PUT", ssURL, ssHeaders, new NetworkCredential(ssUsername, ssPassword), ssData), out ssStatus, out ssStatus_Code, out ssResponse, ssResponse_Headers);
        } // MssHTTPPutBinary

Kind regards,

Vincent Koning


Hello Vincent, 

Couldn't you use the On Before Request callback  and change the address? 

Something like this, maybe? https://www.outsystems.com/forums/discussion/22341/change-rest-server-at-runtime/


Hi Eduardo,

I didn't know about this possibility. I will surely attempt to do this but there another caveat that could throw some issues, on receiving the last chunck of the binary blob the Graph API returns a different JSON and it does when it expects new chuncks. 

Hi Eduardo,

Just to get back to this issue. I'm about to add a forge component that depended on a custom version of this component that allows binary PUT actions. I was unable to get a working version of this requirement with the build-in REST capability of OutSystems. So before I go ahead and post an addendum of this component to the forge I would like to ask you again to add this capability to ardoHTTP. I think more people would benefit from this and it will keep everything in one component which is important to me. 

The action that I have created is as follows;

As you can see it's a copy of the original HTTPPut action with the Data changed to Binary Data. 



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.