API - Implement CORS for Cross-Domain API requests
Currently the API does not support cross-domain requests which makes it impossible to call the API from within WA or any other site. The whole Idea of API's and web services is to be able to fetch data from other sites to use in you JavaScript code.
I can only get access to the API if I disable cross-domain security in IE. Other browsers are more difficult.
CORS is a web standard that was developed to handle cross-domain requests. It should be fairly simple to adjust your web server to handle CORS and pre-flighting
CORS is not implemented, but it is possible to access public API from JS hosted on yourdomain.wildapricot.org. Please refer to http://help.wildapricot.com/display/DOC/Authenticating+API+access+from+a+Wild+Apricot+site+page for more details.
-
Max commented
I'm in the same situation, CORS should at least be enabled for subdomains.
My website at wordpress.mydomain.com already uses SSO to authenticate users. I need my JS app hosted on WordPress to query the API at wa.mydomain.com/sys/api but that's not possible due to CORS restrictions.
Ref: https://gethelp.wildapricot.com/en/articles/1705-working-with-api-from-javascript
-
Hi Bala,
There is no problem to access API from mobile app, our own mobile app for admins works exactly this way. However if you try to access API from ionic builder, then you will face CORS error. Here is a detailed explanation of reasons and possible workaround: http://blog.ionic.io/handling-cors-issues-in-ionic/.
Please let me know if the tutorial helps or not.
Dmitry
-
Bala commented
How does this work when we access from mobile apps. especially hybrid mobile apps? I am trying to test ionic in chrome and I am getting CORS error.
-
Rick Smith commented
The recent enhancement of the API to allow calling from within WildApricot by providing access via a '/sys/api/v2/accounts/' URL eliminates the need for CORS. Calling this way is same domain so no need for cross-domain.
Way to go guys. It's ready proving to be a great enhancement.
We can consider this suggestion closed
-
Rick Smith commented
Hi Dmitry. Currently I just need access from within the WA site. The January update allow API access via the same domain takes care of my initial requirement.
It still would make sense to allow Cross Domain requests for the cases where you may want to call the API from another external website.
-
Hi Rick,
Do you need access Public API from JS hosted on Wild apricot site, of from JS on some external web site?