I’m trying to add a simple REST API call to test out pulling data from the api.meraki.com API, but when I hit Test on my very first Data, I get what I believe are CORS errors ?
How do I fix this in AppGyver ?
It’s not much of an API feature if it doesn’t even work in the developer tools.
Thanks,
Roy.
Error: TypeError: Failed to fetch. Does the server allow CORS?status: undefined
It is what it says, the cors policy, in general, is set from the api provider, in order to limit from where api calls can be made, Appgyver, simply gets blocked on cors policy, so its not what it looks like…
you can take a look here as i told you
So you most likely need to check that you are using the API service correctly.
Using the API service correctly also involves making sure that you are using an allowed method, like ‘GET’ or ‘POST’. There is a similar thread with a CORS issue:
I’m using a GET Request and using the exact same request from Postman on my desktop works perfectly. I’d suggest it’s a failing in AppGyver in it’s ability to work with servers that use CORS.
What I’d like to do is to be able to use the Test on my GET API so that I can build the scheme from the response. So back to the original question, what do I need to do in my browser etc. to get AppGyver to be able to pull the data JSON back down from the API ?
Since it is not an AppGyver related issue I cannot provide much further guidance.
Although in your initial message you have used ‘Get collection’, while from the Cisco Meraki documentation it seems like you need to use ‘Get record (GET)’ instead. Also make sure that you are passing the API key correctly.
Thanks. I was using the AppGyver Get Collection to collect the list in the first instance and then I was expecting to the use the Get Record with an id to retrieve individual records ? Is this how it should be done ? From the Meraki doc the two steps I’d use would be:
"GET returns the value of a resource or a list of resources, depending on whether an identifier is specified.
GET of /v1/organizations returns a list of organizations
GET of /v1/organizations/<org_id> returns a particular organization"
I understand it may not be an AppGyver issue, but I need to run AppGyver in a browser and use the Test command to the be able to build the schema. I cannot get a public API changed, so what are the workarounds that AppGyver needs to do for me to utilise a public API with CORS support ?
I think you are previewing the app in the browser. The requests sent in the browser will be restricted by the CORS policy, that why you can call the API correctly with Postman.
Either you change the API server coding by add the “Access-Control-Allow-Origin: *” or try to preview with a desktop/mobile app.
No, I’m trying to run the “Run Test” in the development env so that I can then hit the Set Schema button to build the variables etc. It’s at this bit it is failing for me.
Hi Roy,
Try using SAP API Management to avoid CORS issues while calling APIs from AppGyver.
Here’s a blog that shows you how to do it: How to Solve CORS Issues with SAP API Management.
Hope it helps. I did it for avoiding issues to call a SAP Workflow Management API from AppGyver and it worked.
Looks like it is CORS issues. Seems to be coming from platform.appgyver.com and so that’s why it doesn’t work. Setting up and API proxy seems like an awful lot of work.
Real shame this won’t work, there’s no way to build the schema without the Test working and there doesn’t seem to be any way to make the Test call. AppGyver wants Meraki to change it’s API and Meraki will say that calls should only be coming from a backend. So, stuck between them.
Perhaps I’ll go use and recommend another low-code vendor as this just can’t work with APIs.
Roy.
As aforementioned, when you want to use any API (REST or ODATA) with Appgyver in a browser, including when using AG preview in a browser, your API endpoints must be CORS-enabled.
Some API packages may be already CORS enabled but it looks like yours is not. Thus the only reliable way to have your API package CORS-enabled is to use an API proxy of the likes of SAP API Management or other API proxy solutions. I hope that helps.