Action | Request method |
---|---|
Create | POST |
Read | GET |
Update | PUT |
Delete | DELETE |
In order to create cards and documents you
var body = '\ <?xml version="1.0" ?>\ <Request>\ <Articles>\ <Article>\ <Fields>\ <Number>AB1234</Number>\ <DscLng1>Wooden table</DscLng1>\ <SalesPrice>1299.00</SalesPrice>\ </Fields>\ </Article>\ </Articles>\ </Request>'; request = new XMLHttpRequest(); request.open("POST", "https://ponte.venice.be/webconnect/api/Demo/Article", false); request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Authorization", "Basic " + Base64.encode ("User:Password")); request.setRequestHeader("Content-Type", "application/xml"); request.onreadystatechange = function () { if (request.readyState == 4) { // Request finished and response is ready. if (request.status == 200) { // Status: OK console.log("Create succeeded."); } else { console.log(request.status); } } } request.send(body);
In order to get one or more items of a Venice object you
request = new XMLHttpRequest(); request.open("GET", "https://ponte.venice.be/webconnect/api/Demo/Article?Number=MyArticle", false); request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Authorization", "Basic " + Base64.encode ("User:Password")); request.onreadystatechange = function () { if (request.readyState == 4) { // Request finished and response is ready. if (request.status == 200) { // Status: OK console.log(request.responseText); } else { console.log(request.status); } } } request.send();
In order to modify Venice data you
var body = '\ <?xml version="1.0" ?>\ <Request>\ <Articles>\ <Article>\ <Fields>\ <SalesPrice>1500.00</SalesPrice>\ </Fields>\ </Article>\ </Articles>\ </Request>'; request = new XMLHttpRequest(); request.open("PUT", "https://ponte.venice.be/webconnect/api/Demo/Article?number=MyArticle", false); request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Authorization", "Basic " + Base64.encode ("User:Password")); request.setRequestHeader("Content-Type", "application/xml"); request.onreadystatechange = function () { if (request.readyState == 4) { // Request finished and response is ready. if (request.status == 200) { // Status: OK console.log("Update succeeded."); } else { console.log(request.status); } } } request.send(body);
In order to delete a card or document you
request = new XMLHttpRequest(); request.open("DELETE", "https://ponte.venice.be/webconnect/api/Demo/Article?number=MyArticle", false); request.setRequestHeader("Accept", "application/json"); request.setRequestHeader("Authorization", "Basic " + Base64.encode ("User:Password")); request.onreadystatechange = function () { if (request.readyState == 4) { // Request finished and response is ready. if (request.status == 200) { // Status: OK console.log("Delete succeeded."); } else { console.log(request.status); } } } request.send();
Code | Name | Description |
---|---|---|
200 | OK | The action has been successfully executed. |
204 | NoContent | The request has been successfully processed, but the response is intentionally blank. |
404 | NotFound | The requested card(s) or document(s) could not be found. |
500 | InternalServerError | A generic error has occurred on the server. Check the error message for more information. |
503 | ServiceUnavailable | Indicates that the server is temporarily unavailable, usually due to high load or maintenance. |
In case of a successful GET request you'll find the data in a response body in the format (json or xml) you've asked for. The data is structured in the same way as in the request body. If a request wasn't successful, you'll potentially get a html text with more info about the error.
If multiple items are requested, the call succeeds if at least one item has been found. Each item in the response, will appear in the same order as reqested. Items that were not found appear as empty items in the json or xml.