Vidal-api.js
To kickstart your project into calling the Vidal API.
Getting started
Preliminary steps
- Make sure your 3scale access is properly configured. If so, you should know your application ID (e.g.
"MY_APP_ID") and access key (e.g."MY_APP_KEY"). - Then, all you need to do is include the following Javascript file (latest version):
https://softwarevidal.github.io/vidal-api.js/vidal-api.js - Alternatively, you can run
bower install vidal-api.js
Finally, you can try the following examples and tailor them to your needs.
Please note they are run against our BETA environment, please contact editeurs AT vidal DOT net for further information.
GET requests
include
https://softwarevidal.github.io/vidal-api.js/vidal-api.js(latest version)
var callback = function(xmlDoc) {
// awesome callback here
};
VidalApiFactory
.create('MY_APP_ID', 'MY_APP_KEY')
.get("http://apirest-beta.vidal.fr/rest/api/molecules?startwith=a", callback);POST requests
include
vidal-api.js2.
var callback = function(xmlDoc) {
// awesome callback here
},
contents = "\
<?xml version='1.0' encoding='UTF-8' standalone='yes'?> \
<prescription> \
<!-- etc etc --> \
</prescription>";
// default payload type is: 'application/x-www-form-urlencoded'
payload = PayloadFactory.create(contents, "text/xml");
VidalApiFactory
.create('MY_APP_ID', 'MY_APP_KEY')
.post("http://apirest-beta.vidal.fr/rest/api/alerts", callback, payload);Troubleshooting
Please feel free to open an issue, with as many details as possible.