I am calling GET /drive/items/{item-id}/content?format=pdf endpoint to get the file content in PDF format. The call returns with a status 302 and a location header. if we do get call on this location from our web app, it fails during the options call with a status of 404.
Here is the request we are doing to get the pdf contents.
GET https://graph.microsoft.com/v1.0/drives/b!gsJ9tz6DCkGyfdaU5v6ixyaFWxnS3xFCqH4I1SLV8CdtgB6dTj-DS6PTgkh_en6V/items/017JOTXVHOWSIA4OPTEND3H2D55XXSKVVG/content?format=pdf
It returns this URL in location header. The url if I open directly in browser works fine and I am able to download the pdf. But if I do a get call with JS it fails on options call with 404.
It looks like CORS is not correctly supported for this endpoint. Any help in this regard would be appreciated.
Related
I have tried everything I could think of to download any document from this page: https://www.acingov.pt/acingovprod/2/index.php/zonaPublica/zona_publica_c/indexAdjudicacoes/165
The download button launches a new window (while sending a POST request), the URL changes, but after a while this new page redirects to the homepage. I can see, using a HTTP sniffer, some ids and recaptcha response being sent to the new window, but nothing really happens and no ZIP file is downloaded. Tried different browsers and OSes. Any ideas/solutions? Thanks
I'm trying to use the Google Picker API to display a picker for the user to select a file. I have this working great in a web app (in a normal browser), but when I run the same code in an electron app, I see a 400 message in the popup iframe, and get the following console errors:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://docs.google.com') does not match the recipient window's origin ('file://').
Failed to load resource: the server responded with a status of 400 ()
The core problem seems to be that the electron browser window has an origin of file://. This seems to cause two problems:
The (chromium) browser security blocks the cross-origin iframe communication
Google rejects the request as not coming from a valid origin (and you can't add file:// as an origin in the developer console)
I can't think of any way to overcome these problems, but I'm hoping that someone has an idea.
You could create an app and host it in something like following, and then point the electron BrowserWindow to the url.
https://app.yourdomain.name/gdrive/picker?token=access_token
That should work I believe.
I'm trying to create a connection to an external OData API from PowerApps.
I've created a custom connector via a Postman collection - the custom connector appears to work correctly in test mode but as soon as I try to consume it in the PowerApp I always get a 404 error popup in the expression editor.
Checking the POST request made to https://europe-001.azure-apim.net/invoke and re-playing it with all headers via Postman results in the same 404 error:
{
"statusCode": 404,
"message": "Resource not found"
}
Testing the API in the PowerApps Swagger editor comes back with the results, but instead of a POST to the above URL where headers are sent with the API endpoint address, a GET is made instead.
If I replay this GET request with the same headers etc, I get the same 404. The only thing that changes per request is x-ms-client-request-id so I assume this is to prevent XHR replays.
Am I missing some publishing step for my custom connector?
Has anyone got something like this working?
Edit:
Interestingly - I tried this with a basic API at jsonplaceholder.typicode.com and this works. The API requires no auth and returns data to my Powerapp without an issue.
I'm not sure why this is different from the other custom connector apart from the authentication mechanism.
Edit edit:
This may be a bug in PowerApps - MS support are looking into it for me and another user stated their connectors stopped working since the October release with the same error.
I have integrated slack in my custom application using the API provided by Slack.
I am able to fetch the post from Slack and able to display it in my application. I am able to fetch the image that was uploaded with the post (Few days back) but today when I added a post with the image. The image is not being displayed in the application, when I am trying to access the image URL in the browser it is asking for Authentication.
I am accessing the slack rest API to fetch the post from slack. from the response I am taking the "thumb_64" parameter from the "file" object.
I am able to access the below image URL, this image was uploaded on 2016-01-11
https://files.slack.com/files-tmb/T0F8RH7U7-F0J505EG1-33434fadf3/screenshot_from_2015-12-28_15_23_39_160.png
But I am not able to access the below mentioned URL ,this image is uploaded on 2016-02-16
https://files.slack.com/files-tmb/T0F8RH7U7-F0MHZL70Q-d740ed784b/configration_160.png
Thanks & Regards,
Have you seen the update where #slackapi announced about accessing files using the Web API?
Essentially, you now need to provide authentication to access file assets, by specifying an HTTP Authorization header with an OAuth token that has the correct scopes to access that kind of data for a team.
For example, you'd send a header like this with your GET request:
GET https://files.slack.com/files-tmb/T0F8RH7U7-F0MHZL70Q-d740ed784b/configration_160.png
Authorization: Bearer YOUR_VALID_ACCESS_TOKEN_HERE
The File type documentation goes into further detail.
I'm debugging my ASP.NET MVC 3 web app using Google Chrome Developer Tools, and for some reason, the error "Unexpected response code: 401" gets logged every time a page is loaded. I don't have a clue for which request DevTools is receiving this response, though; I've even inspected the Networkpane in DevTools, without seeing any such response from the server. Also, the app appears to work just fine, I can't see the 401 response having any actual effect.
How can I tell in DevTools what causes this response from the server?
With the network pane open, reload the page. Each row in the pane represents a different resource - you can sort the status column by clicking on it. Once you've found your 401, click on the page resource (the left-hand column) to see the request/response details.
From the Wikipedia page List of HTTP status codes:
Similar to 403 Forbidden, but specifically for use when authentication
is possible but has failed or not yet been provided.[2] The response
must include a WWW-Authenticate header field containing a challenge
applicable to the requested resource
So your root problem is that you either haven't provided authentication details or the details provided weren't accepted.