|
Onuma Web Services POST
Onuma Web Services API ('POST' - UPDATE) (Note: V1 - a more RESTful V2 is being added shortly)
Note:
Updating data through Web Services is only authorized
for owned Schemes or Teamwork Schemes.
- The base URL for POST is:
http://www.onuma.com/plan/webservices/post.php?u=<username>&p=<password>
- POST - Update Equipment Data:
http://www.onuma.com/plan/webservices/bldgXML.php
with the following URL Parameters in addition to username and password:
sysID=<Studio ID>
bldgID=<Building ID>
&equipment
-> format of XML data: equipment.xml
- POST - Update Installation records:
same as 2. but instead of &equipment use &installation
-> format of XML data: installation.xml
- POST - Update Manual records:
same as 2. but instead of &equipment use &manual
-> format of XML data: manual.xml
- POST - Update Warranty records:
same as 2. but instead of &equipment use &warranty
-> format of XML data: warranty.xml
- POST - Update Spare records:
same as 2. but instead of &equipment use &spare
-> format of XML data: spare.xml
- POST - Update Space records:
same as 2. but instead of &equipment use &space
-> format of XML data: space.xml
- POST - Attach File:
same as 2. but instead of &equipment use &attach
and add the following URL Parameters:
rawname=<Name of file w/o extension>
ext=<Extension including the dot, e.g. .pdf>
The following file types can be uploaded:
txt, rtf, doc, xls, xml, pdf, jpg, gif, png, ifc, zip
All others should be archived in a zip file before posting through the Web Services.
Sample Code for PHP (using cURL):
<?php
// XML file:
$xml = file_get_contents('sample.xml');
$u=<username>
$p=<password>
$sysID=<sysID>
$bldgID=<bldgID>
$rs="http://www.onuma.com/plan/webservices/post.php";
$qs="";
$parray=array('u'=>$u,'p'=>$p,'sysID'=>$sysID, 'bldgID'=>$bldgID);
foreach($parray as $par=>$value){
$qs=$qs."$par=".urlencode($value)."&"; // urlencoded to not create problems in the HTTP header
}
$level = "equipment";
$url="$rs?$qs&$level";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$response = curl_exec($ch);
curl_close($ch);
// returned response from OPS Web Services
echo $response;
?>
|