I have decided to use an XFormat Node to grab my JSON POSTFIELDS from an API invoke using PHP. Below is the result of the XML data transformed from the JSON string to a XMLDocument:
<root>
<salesValue>5000</salesValue>
<authorId>2</authorId>
</root>
Reading from https://developers.flowgear.net/kb/Node:XPath_Match I came up with the following xpaths to grab those values am interested in and inject them on my SQL Query:
- salesValue:root/salesValue
- authorId:root/authorId
I have chosen XML as my escaping value for that property not sure which one it should be. The error I am getting is:
(XFormat 1.0.0.1): Namespace prefix 'salesValue' is not defined.
I guesss the issue is with how I have formatted my xpath in an attempt to grab those values. The SQL Query in the expression property of my XFormat node is shown below:
SELECT `Book`.`id` , `Book`.`name` , `Book`.`isbn` , `Book`.`quantity_in_stock` , `Book`.`price` , (`Book`.`quantity_in_stock` * `Book`.`price`) AS `sales`,
concat(`Author`.`name`, ' ', `Author`.`surname`) AS `author` FROM `books` AS `Book` LEFT JOIN authors AS `Author` ON ( `Book`.`author_id` = `Author`.`id` )
WHERE (`Book`.`quantity_in_stock` * `Book`.`price`) > {salesValue} AND `Book`.`author_id` = " {authorId}"
Should I have these values injected in that query I will be able to move forward. Below is the script I use to invoke the WORKFLOW via an API:
try{
$results = invokeFlowgear("https://domain.flowgear.io/authorbooksaleslist", "login", "passwrd", 30,
array(
'salesValue' => 5000.00,
'authorId' => 2
));
var_dump($results);
}catch(Exception $exc){ print $exc->getMessage(); }
Thank you in advance...