From 034479de3f8d9e2484dc1f66291e2398a3b279db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Franusic?= Date: Tue, 4 Dec 2012 01:20:07 -0800 Subject: [PATCH] Update SPEC.markdown adding curl command example --- SPEC.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SPEC.markdown b/SPEC.markdown index a659a64..cfd785e 100644 --- a/SPEC.markdown +++ b/SPEC.markdown @@ -63,15 +63,17 @@ Notice the value of output is an array. This is because you may get back multipl ### Using a block A block endpoint has normal HTTP semantics, but using input and output data structures. The request body should be empty or be a valid input envelope with an input record, and the response body should be empty or be a valid output envelope with one or more output records. The input and output records must have keys that match the inputs and outputs defined in the block definition. + $ curl -d '{"inputs": [{"foo": "Value for foo input","bar": "Value for bar input"}]}' -H "Content-Type: application/json" http://example.com/block-endpoint + >>> POST /block-endpoint >>> Content-Type: application/json >>> …more headers… - >>> {"input": {"foo": "Value for foo input", "bar": "Value for bar input"}} + >>> {"inputs": [{"foo": "Value for foo input", "bar": "Value for bar input"}]} <<< 200 OK <<< Content-Type: application/json <<< …more headers… - <<< {"output": [{"baz": "Value for baz output", "qux": "Value for qux input"}]} + <<< {"output": [{"baz": "Value for baz output", "qux": "Value for qux output"}]} ### Getting a block definition The block definition is exposed in the body of response to an OPTIONS request on the block endpoint.