Information Classification: External Restricted.
See https://www.chili-publish.com/security

Logging in to the WebServices

Most calls to the webservice require an apiKey argument. Developers can create this key using the GenerateApiKey function (supplying login information).

The generated apiKey expires after a number of hours without activity (this is a sliding expiration. As long as the key is being used, it wont expire). Settings for the expiration of API keys can be configured either on the environment or server settings level, through the BackOffice.

The URL of the webservice can be found on:

http://www.yourserver.com/main.asmx
orhttp://www.yourserver.com/CHILI/main.asmx
(depending on how you installed CHILI)

IMPORTANT NOTE: we recommend generating one api key per end user session. Less can be constricting for future development (see ??API Key Settings). More (eg per page visit in your portal) can become a performance drain, as all api keys need to be checked for expiry and cleanup on a regular basis.

.NET

//CREATE INSTANCE OF WEBSERVICE
CHILI_WS.ws.Url ="http://www.yourserver.com/CHILI/main.asmx"
string keyXML = ws.GenerateApiKey("ENVIRONMENT_NAME","USER_NAME","PASSWORD OR MD5_PASSWORD");/

keyXmlDoc.LoadXml(keyXML);
XmlDocument keyXmlDoc = new XmlDocument();

if (keyXmlDoc.DocumentElement.GetAttribute("succeeded") == "true")
{
	//STORE KEY (in real life you would store this in a session or application variable, of course)
	string key = keyXmlDoc.DocumentElement.GetAttribute("key");//DO MAGIC
}
else
{
	throw new Exception(keyXmlDoc.DocumentElement.GetAttribute("errorMessage");
}

PHP

To use SOAP in php you must have the native SOAP installed on your server. For more information about this please consult: http://www.php.net/manual/en/soap.installation.php .

If you are not able to install PHP SOAP you can also use Zend Framework SOAP module

<?php
// PHP SOAP CONNECTION

$client = new SoapClient("http://yourdomain.com/CHILI/main.asmx?wsdl");
try{
	$rawXMLresponse = $client->GenerateApiKey(array("environmentNameOrURL" => "Yourenv","userName" => "username", "password" => "pass"));
	var_dump($rawXMLresponse->GenerateApiKeyResult);
	$dom = new DOMDocument();
	$dom->loadXML($rawXMLresponse->GenerateApiKeyResult);
	echo "KEY: <br />";
	var_dump($dom->getElementsByTagName("apiKey")->item(0)->getAttribute("key"));
	echo "succeeded: <br >";
	var_dump($dom->getElementsByTagName("apiKey")->item(0)->getAttribute("succeeded"));

	echo "Load editor<br />";

}catch(SoapFault $fault){
	echo "Fault code: ".$fault->faultcode;
	echo "Fault string: ".$fault->faultstring;
}
?>

The retreived "key" value can then be used in all subsequent calls to the webservices.
If the user you logged in with belongs to the "Admin" environment, you can continue by changing the working environment to any of the other environments using the SetWorkingEnvironment function.

All information on this page must be treated as External Restricted, or more strict. https://www.chili-publish.com/security