I'm using IoTHub F1 subscription and facing following problem:
I'm calling REST endpoint for get device list from iothub,
Ex: https://my_iothub_name.azure-devices.net/devices?top=10&api-version=2016-11-14
The above api call is working fine from postman (postman is ApiAgent)
But the problem is when I'm calling same api from browser it's giving me 405 method not allowed error.
I've read about it and it's looks like problem with OPTIONS request from browsers.
Please throw some lights on this issue,
Thank you very much.
I don't think this is currently possible, first because, from what I see, Azure IoT hub REST API does not issue CORS requests (i.e. they don't write in the CORS header access-control-allow-origin), so your browser client can't access it.
Related
I have an nodejs api which gives a valid response in postman/browser. Tried to add the api in WSO2 api manager and followed the steps in the tutorials to succesfully publish the api in API Manager. But when created an product and using an auth token to call the created API getting the failed to fetch error as below:
Have tried enabling cors which didnt solve the issue. The api from the apim store isnt hitting the node server api.
Copy and run that URL in a browser tab and accept the certificate. Then try again. It should work.
I have an Azure bot which is all developed and working fine. It currently talks to a 3rd party workflow application via a simple webhook.
I am now trying to replicate this using Azure Logic App. I have a simple logic app that responds fine to requests from POSTMAN. However, when I set the Messaging Endpoint in the Azure Bot service to the URL of the logic app's top node (when a http request is received), I see 401 unauthorized responses from all of my channels in the bot and I don't know why. POSTMAN is using the exact same target URL and works fine.
Any ideas what is going on here?
I had a similar problem, and found the solution was to first ensure an Authorization header is being sent, and 2nd, set the value to null.
Refer: https://learn.microsoft.com/en-us/outlook/actionable-messages/security-requirements#action-authorization-header
Need some help :) I have created a simple AWS API Gateway with a lambda backend just for trying it out. The only response is { "date": "2017-01-01" }, and the only method accepted is GET. When I test the API in the AWS Console it works fine. The response is as expected. But when I try to access it externally I get an Internal error message response. It kind of blows of course. Do I have to setup a elastic IP for this to work? I shouldn't have to add any roles to the API Gateway (I assume) since the role only declares what resources the API Gateway should be allowed to access? Or is there a "external access" role of some kind? Ot do I have to provide any HTTP-header when accessing the API?
Please enable CORS if you accesing API from an external domain. Please see the screenshot below, which shows how to enable CORS
I am using Serverless framework to create lambda functions with node.js backend that uses fcm-push package.
Desired flow :
Call api from mobile app -> api uses fcm-push package to send the payload/message/registration tokens to Firebase Cloud Messsaging -> sends push notification to Android and iOS devices
This works perfectly when I run the api locally using "serverless invoke local..."
However, when I do "serverless deploy" and hit the api endpoint from mobile app OR a rest client like Postman, the api call times out, i changed the timeout to 45 seconds and still times out. To troubleshoot, I removed all fcm related code from the api to see if api returns a response while hitting from mobile app/Postman. It does. So it seems like AWS is preventing the api to make a call to fcm, and the call lasts until it times out.
I am not sure what I can do to get around this as I am fairly new to using AWS, so any input would be helpful
If you are using API Gateway as API endpoint which is connected to a lambda function, then you need to specify the body template in the API gateway itself. Make sure you are able to get the values at your Lambda function that you have been sending via the REST API call to your API gateway.
Please find the link to this answer I wrote earlier to achieve the same.
You should check for any break point in your function.
I am using Azure DocumentDB with REST API and trying to call the API from HTML page using Ajax requests. But I found that authorization headers are not getting added in a request. After searching, a lot, I found that it may be a CORS issue. Same request works well when POSTMAN tool is used. Security header got set in this case.
You're correct! DocumentDB REST API can't be called using AJAX from the browser because of CORS and right now it is not possible to configure CORS settings for a DocumentDB account.