42
Views
12
Comments
"Range" header in REST call

I am trying to use the Graph API to retrieve a file in chunks. If you read this site: https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http you can see that it is possible to add the "Range" header to a REST call and retrieve just a few bytes. If I test this in Postman this works correctly. Adding the Range bytes=0-1024 header just gives me the first 1024 bytes of the file.

However whatever I try in Outsystems it doesn't seem to want to work. It seems the header doesn't get send at all, it gets ignored and I retrieve the entire file.

What have I tried?

- Adding it as a header in the REST Api
- Adding it as header in the REST API Method
- Adding it as a header in the OnBeforeRequest

All giving me the same result.


If I log the contents of the HTTPRequest.Headers objects in the OnBeforeRequest the header is there and seems to be correct. 

Am I doing something wrong?

2019-01-07 16-04-16
Siya
 
MVP

Please see if ardoHTTP forge component solves the issue. They have support for Range Headers ( please see the discussion @ https://www.outsystems.com/forums/discussion/44125/ardohttp-range-header/ )

UserImage.jpg
Martijn van Doesselaar

Thanks Siya, I found that topic too but I didn't want to solve this by using a different forge component. This should be supported by outsystems I think.


However, I have solved my issue. In the end I didn't need the Range header. I wanted to stream a video but apparantly the video html tag supports the graph api download url and that streams by itself.


2019-01-07 16-04-16
Siya
 
MVP

I have tested against an echo server and looks like this Range Header is trimmed out. Here I have sent two headers ( Range, TestHeader)  but one only one is echoed back.

Someone with experience may confirm.

2022-12-30 07-28-09
Navneet Garg

I know about range headers. but I tried same thing in outsystems and it is not working.

To test range header server should support. you can check following documentation for more detail.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range

https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests

If server supports and you send range header and if content is more than requested range than api respond with 206 Partial Content

Link for the api range header testing -  https://i.imgur.com/z4d4kWk.jpg

Can any one share how a partial content request can be done in OutSystems?

I also tried OnBeforeRequest handler to add Range header but it is not working.

UserImage.jpg
Martijn van Doesselaar

These are exactly the experiences I have as well. The exact same request works in Postman but not in outsystems and it seems like the "range" header is actively being filtered by outsystems but I'm not sure why.

The funny thing, the other way around, while uploading bytes and sending the Content-Range header, it does work.

Maybe I should create a ticket to see if it is a bug.

UserImage.jpg
Martijn van Doesselaar

I created a ticket and they came with the following response:

-------

Hello Team,
 
Hope this email finds you well.
 
First of all, we appreciate you bringing this matter to our attention.
 
We have reviewed the issue with our R&D team, and we would like to share our findings. The platform has a predefined list of headers that are automatically excluded from requests - this list includes the Range header.
 
As a result, we can confirm that the Range header is being removed both during the Test REST execution in Service Studio and at runtime - This is expected behaviour since the platform is actively removing that header from the request.
 
However, an RPM (RPM-5655) has been created to evaluate the possibility of adding support to the range request header. You'll be able to track the progress on the Support Portal since it's already linked to this support case.
 
Since we believe that there are no pending actions from the Support team we will tentatively place the present ticket as solved.
 
Nonetheless, if you have any other questions or concerns, don't forget that you can always reopen the case by responding to this message, and we will gladly assist you. You will have up to 15 days to do so. After these 2 weeks, you can always open a new support case and refer back to this case as a follow-up.
 
Best regards, 

--------


The created problem is: https://www.outsystems.com/SPP_Ticket_UI/Problem_Detail?CaseId=3135801&ProblemId=RPM-5655 


Thanks all for your help and investigation.

2022-12-30 07-28-09
Navneet Garg

Thanks for the update as we can not access the link. Please post update if any on the thread in future.

2019-01-07 16-04-16
Siya
 
MVP

@Navneet Garg : Tickets are private and accessible only to assigned users and hence URL is not accessible to us.

@Martijn van Doesselaar : Since OutSystems confirmed this feature is unavailable, you may consider using a Forge component as previously discussed.

2022-12-30 07-28-09
Navneet Garg

Yes @Siya , I know that that's why I ask @Martijn van Doesselaar to keep up posted on update on this if he received something on the thread.

I don't think ardoHTTP will work as outsystems is removing it from runtime. I am trying that and update if it will work.

2019-01-07 16-04-16
Siya
 
MVP

@Navneet Garg I misunderstood your statement hence I commented on that :) 

ArdoHTTP, being an extension, operates outside the limitations of OutSystems’ built-in REST capabilities and is not subject to this restriction. It allows custom handling of HTTP requests, including setting headers that OutSystems runtime normally removes.

Unless explicitly stated otherwise by OutSystems, ArdoHTTP remains a viable solution to bypass this limitation. If you have tested it and found it does not work, please share specific findings.

UserImage.jpg
Martijn van Doesselaar

I will keep you guys posted if there is any progress.

As for my original problem, I didn't need the range header for my use case after all. I could solve it in a different way. 

But I still wanted to log this issue with outsystems as I can see myself, and other people, needing it in the future.

2022-12-30 07-28-09
Navneet Garg

You mentioned that Content-Range is working for you right so this is the solution if any one face this issue.

but I think server should also accept this header (Content-Range) else it wont work.

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