Fix unit tests for Python in a twistd instance
[OpenSRF.git] / examples / simple_text_curl.sh
1 #!/bin/sh
2
3 # Simple demonstration of invoking a public OpenSRF method via curl
4
5 # Expected output will be something like:
6 # [{"__c":"osrfMessage","__p":{"threadTrace":"0","locale":"en-CA","type":"RESULT","payload":{"__c":"osrfResult","__p":{"status":"OK","statusCode":"200","content":4}}}},{"__c":"osrfMessage","__p":{"threadTrace":"0","locale":"en-CA","type":"STATUS","payload":{"__c":"osrfConnectStatus","__p":{"status":"Request Complete","statusCode":"205"}}}}]
7
8 #curl -H "X-OpenSRF-service: opensrf.simple-text" --data 'osrf-msg=[{"__c":"osrfMessage","__p":{"threadTrace":0,"type":"REQUEST","payload":{"__c":"osrfMethod","__p":{"method":"opensrf.simple-text.reverse","params":["foobar"]}},"locale":"en-CA"}}]' http://localhost/osrf-http-translator
9 curl -H "X-OpenSRF-service: opensrf.simple-text" --data 'osrf-msg=[{"__c":"osrfMessage","__p":{"threadTrace":0,"type":"REQUEST","payload":{"__c":"osrfMethod","__p":{"method":"opensrf.simple-text.split","params":["This is a test, it%27s only a test"]}},"locale":"en-CA"}}]' http://localhost/osrf-http-translator
10 #curl -H "X-OpenSRF-service: opensrf.simple-text" --data 'osrf-msg=[{"__c":"osrfMessage","__p":{"threadTrace":0,"type":"REQUEST","payload":{"__c":"osrfMethod","__p":{"method":"opensrf.simple-text.substring","params":["foobar", 3, 1]}},"locale":"en-CA"}}]' http://localhost/osrf-http-translator