The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
cURL not returning results in Execute Process
![rachel_lomasky](https://us.v-cdn.net/6030995/uploads/defaultavatar/nCCNNSPK1YM69.jpg)
![](https://s3.amazonaws.com/rapidminer.community/vanilla-rank-images/maven-16x16.png )
When I run the following code on the command line:
curl -X POST -H Content-Type:application/json -H Accept:application/json http://api.intellexer.com/analyzeSentiments?apikey=a91714aa-4db7-4264-8ab9-f209f592a0b3 -d '[{"id":"1","text":"neurotic"},{"id":"2","text":"tiny"},{"id":"3","text":"sensibility"}]'
I get the response:
{"sentimentsCount":3,"ontology":null,"sentences":[{"sid":"1","text":"<neg w=\"-1.65\">neurotic<\/neg>","w":-2},{"sid":"2","text":"<neg w=\"-1.65\">tiny<\/neg>","w":-2},{"sid":"3","text":"sensibility","w":0}],"opinions":null,"sentiments":[{"author":null,"dt":null,"id":"1","title":null,"w":-2},{"author":null,"dt":null,"id":"2","title":null,"w":-2},{"author":null,"dt":null,"id":"3","title":null,"w":0}]}
However, when I run it through an Execute Process, the document it returns is size 0.
I know that the header parameters need to be unquoted in this case, but I'm wondering what else I need to do to retrieve a response.
Here's my process:
<?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
<operator activated="true" class="productivity:execute_program" compatibility="7.4.000" expanded="true" height="103" name="cURL for sentiment (2)" width="90" x="45" y="34">
<parameter key="command" value="curl -X POST -H Content-Type:application/json -H Accept:application/json http://api.intellexer.com/analyzeSentiments?apikey=a91714aa-4db7-4264-8ab9-f209f592a0b3 -d '[{"id":"1","text":"neurotic"},{"id":"2","text":"tiny"},{"id":"3","text":"sensibility"}]'"/>
<parameter key="log_stdout" value="true"/>
<parameter key="log_stderr" value="true"/>
<list key="env_variables"/>
</operator>
</process>
<?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
<operator activated="true" class="text:read_document" compatibility="7.2.001" expanded="true" height="68" name="to document (18)" width="90" x="179" y="34">
<parameter key="extract_text_only" value="true"/>
<parameter key="use_file_extension_as_type" value="true"/>
<parameter key="content_type" value="txt"/>
<parameter key="encoding" value="SYSTEM"/>
<description align="center" color="transparent" colored="false" width="126">surveys to document</description>
</operator>
</process>
<?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
<operator activated="true" class="text:json_to_data" compatibility="7.2.001" expanded="true" height="82" name="JSON To Data (19)" width="90" x="313" y="34">
<parameter key="ignore_arrays" value="false"/>
<parameter key="limit_attributes" value="false"/>
<parameter key="skip_invalid_documents" value="false"/>
</operator>
</process>
P.S. The token is a free trial one, so no worries as far as giving that away.
0
Answers
Dear Rachel,
We tried to reproduce your problem and also received somewhat strange results. What we did find out is that this highly depends on the OS where you execute the command. Execute Program is definitely able to execute the cURL command and delivers results with simpler options.
In order to be more platform independent (OS X vs. Unix vs. Windows) we recommend the operator Enrich Data by Webservice which is used in the attached example process.
Best,
Edin