OneDrive API 2.0 for buisness returns http status code 200 instead of 302 for download API - onedrive

Download API for OneDrive for business 'GET /drive/items/{item-id}/content' returns file content with 200 HTTP status. Document 'https://dev.onedrive.com/items/download.htm' says, It will return 302 Found response with Location.
I am trying to hit the request using rest client.
even i tried providing if-none-match header with etag value, where in i was expecting an HTTP 304 Not Modified. in turn it returned 200 OK response.
Is it a known issue?
Thanks
Sonia

Related

GET API response 308 followed by 304

I am trying to understand the GET requests and responses obtained from a single user click. Is this intended and correct behavior?
On web UI, I clicked the Download button:
At Chrome Developer Tool - Network:
I noticed 2 requests in which the file path syntax is different. first request //opt , second request /opt:
GET requests:
1: https://test.com:8088/download//opt/app/shared/test/0001/result.zip
2: https://test.com:8088/download/opt/app/shared/test/0001/result.zip
Responses:
first: Status Code: 308 PERMANENT REDIRECT (from disk cache)
second: Status Code: 304 OK

What is the difference between a postman request and a request from heroku or localhost

I can make a request from postman but when I make the same exact request (I'm talking about even copying the code from postman) I get an error.
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://glacial-stream-35306.herokuapp.com' is therefore not allowed access.
Even with the cors-eveywhere chrome extension and attempting to use jsonp I cannot get it to work. Even though the request goes through every time on postman.
What makes a postman req different from a request from a Heroku app?

REST API - request to another account's record returns empty string or HTTP 404?

Should be to the request to resource in REST API that belongs to another account returned HTTP 404 status code or HTTP 200 with an empty string?
You may be looking for 403 Forbidden. This is for a case when the resource is present, but the (possibly) logged in user does not have permission to get.
The 404 Not Found should only be used if the resource is not present, meaning other permissions would not help.
200 OK should only be given if the request completed successfully, the client got a valid representation of the resource.
Agree with #Robert Bräutigam that HTTP 403 seems most appropriate.
However, consider a URL like:
/api/some-user-user-id/profile
If you return 403 for existing users and 404 for non-existent users - you could be enabling outsiders to discover user ids.
This may or may not be a problem.

PUT/POST request in SOAPUI giving 403 forbidden, while same request working fine in rest client Postman

There is no authentication on server side so authentication should not be issue.
URL format: PUT
https://localhost/api/v1/protections?integrationKey=111&userKey=1111&group=111&category=foo
Payload:
{"action":"BLOCK"}
This is working fine in Postman.
In SOAP UI , I am giving input as under:
EndPoint: https://localhost
Resource: /api/v1/protections
Parameters:?integrationKey=111&userKey=1111&group=111&category=foo
in Media type, I am selecting "application/json"
and entering {"action": "BLOCK"} but getting "Wed Jan 20 16:25:27 PST 2016:DEBUG:Receiving response: HTTP/1.1 403 Forbidden
"
Is there any suggestion to get the output in SOAP UI.
Depending on the server where the rest is exposed service generates an HTTP 403, you should verify that server is and thus find the fastest response.
Also try making a GET request from the browser to see if you can answer correctly because problem lock your machine to the server.
As is https, it may be that you lack some certificate set SOAPUI. possibly Postman you use already has configured. Try to check this setting.
In my case, I missed the Header "User-Agent" and "accept". I put in Soap UI and Works.
In Postman, this headers it put automatically.

how can I create a URL/site to send a HTTP 204 or HTTP 403 response?

I'm trying to create an app with a login page to POST to a url and return a status code. For now the app is to call a URL that returns a HTTP 204 or HTTP 403 response. How is this done? Do I need to create/implement a servlet?
You certainly can implement your own web service to return those HTTP responses.
For testing your app you can use services like httpbin.org
For example: To get a 403 response, simply send a request to http://httpbin.org/status/403
Created a servlet using Maven/Eclipse/Tomcat and used HttpServletResponse