January 2019
Intermediate to advanced
520 pages
14h 32m
English
Compile the code, run it, and use curl to check the result. First, let's check the traditional JSON format:
$ curl --header "Content-Type: application/json" --request POST \ --data '{"distribution": "uniform", "parameters": {"start": -100, "end": 100}}' \ "http://localhost:8080/random?format=json"
This will return a JSON response that we've seen before: {"value":-19.0}. The next request will return a CBOR value:
$ curl --header "Content-Type: application/json" --request POST \ --data '{"distribution": "uniform", "parameters": {"start": -100, "end": 100}}' \ "http://localhost:8080/random?format=cbor"
This command won't print a response to the console, because it's in binary format. You'll see the following warning ...
Read now
Unlock full access