Closed chuma closed 11 years ago
@chuma, this you can do by passing the raw JSON in via STDIN
. For example:
echo '[{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}]' | http api.sen.se/events/
@jakubroztocil good job! you solve my problem
@jakubroztocil, I am using the http 0.9.2 and it seens that it doesn't work that anymore.
I've created a test.php with the code:
<?php
print_r($_REQUEST);
Then i tried the requests below:
echo '[{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}]' | http http://localhost/CRMvTiger_Rodobens/test.php Return: Array ( )
echo '[{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}]' | http --form http://localhost/CRMvTiger_Rodobens/test.php Return: Array ( )
echo '[{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}]' | http --json http://localhost/CRMvTiger_Rodobens/test.php Return: Array ( )
echo '{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}' | http http://localhost/CRMvTiger_Rodobens/test.php Return: Array ( )
echo '{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}' | http --json http://localhost/CRMvTiger_Rodobens/test.php Return: Array ( )
echo '{"feed_id": 24571, "value": 64.0}, {"feed_id":24572, "value":60.0}' | http --form http://localhost/CRMvTiger_Rodobens/test.php Return: Array ( [{"feed_id":24571,"value":_640},{"feedid":24572,"value":60_0} ] => )
The only which return something is the last one, but not was i was expecting, it returned all json as a key with an empty value.
Was trying to use httpie to post multiple events using the http://open.sen.se/ API. This accepts an array of unnamed objects in the form of:
Found that I could not seem to make httpie create JSON like this. Attempting to use the
:=
separator for raw JSON without a key name created this output: