Hi folks,
As per the subject, I'm looking for some examples of curl script in order to access to the API of Dataminer. I didn't find them in the documentation.
Thanks in advance.
Jordane
Should be possible to call an API method of DataMiner with cURL like this:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"host": "", "login": "Username", "password": "Password", "clientAppName": "myApp", "clientAppVersion": "1.0", "clientComputerName": "clientTestDevice"}' \
https://mydma.mycompany.local/API/v1/Json.asmx/ConnectApp
The result will be a JSON string.
On Windows you might have to escape quotes:
curl --header "Content-Type: application/json" \
--request POST \
--data "{\"host\": \"\", \"login\": \"Username\", \"password\": \"Password\", \"clientAppName\": \"myApp\", \"clientAppVersion\": \"1.0\", \"clientComputerName\": \"clientTestDevice\"}" \
https://mydma.mycompany.local/API/v1/Json.asmx/ConnectApp
Other web methods can be called in a similar way.
An example running in windows PowerShell:
curl.exe --request POST 'http://localhost/API/v1/soap.asmx' --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:http://www.skyline.be/api/v1/ConnectApp" --data '@new3.xml'
new3.xml is a file with the xml payload as below and response is in xml.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:v1="http://www.skyline.be/api/v1"><soap:Header/><soap:Body><v1:ConnectApp><v1:host>?</v1:host><v1:login>?</v1:login><v1:password>?</v1:password><v1:clientAppName>?</v1:clientAppName><v1:clientAppVersion>?</v1:clientAppVersion><v1:clientComputerName>?</v1:clientComputerName></v1:ConnectApp></soap:Body></soap:Envelope>
Thank you both of you for your example. I will test them ASAP.
Jordane