Using a microservice

Using Auto GUI

  1. Once an API doc is created, the Auto GUI section will automatically display a form where users can enter input values without creating a JSON input. The form will follow the Input JSON Schema of the API documentation. Values from the Example Input Value of the API doc will be entered already in the form. Enter values in the form and click “Run”
_images/use_gui_1.png
  1. If a value is null, select “is null?” before selecting Run. An empty value will be interpreted as an empty string “” not null
  2. If you want users to enter a value among a set of possible values, use “enum” in the Input JSON Schema. The field for the variable will automatically change to a choice field in the Auto GUI section.
_images/use_gui_3.png _images/use_gui_3.1.png

Calling a microservice via API

  1. Using an interface of your choice, make a HTTP request to a runnable’s endpoint as specified in an API documentation. Note the followings:
    1. The Authorization header should be prefixed with “Token “ before your token value
    2. Your token value can be found in your account page
    3. Your input should be wrapped inside “input” key
  2. An example curl command for our simple sum runnable would look like follow:

curl -X POST -d '{"input": {"a": 3, "b": 2}}' \
-H "Authorization: Token xxxxxxx" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
http://www.knowru.com/api/runnable/simple-sum-python/run/

Batch-processing a file

  1. Create a file where each row is an input JSON. The first row will be disregarded. Save the file in a directory of your choice
input_json
{"a": 1, "b": 3}
{"a": 0, "b": 4}
{"a": -1, "b": 5}
{"a": 2, "b": 6}
{"a": 2, "b": 1}
{"a": 3, "b": 3}
{"a": 4, "b": 5}
  1. In a runnable’s detail page, click “View Batches”
_images/batch_2.png
  1. Click “Batch Runnable”
_images/batch_3.png
  1. Choose the file, leave a message and click “Batch”
_images/batch_4.png
  1. This will direct you to a page where you can see a list of batch requests for the runnable. Wait until your batch request’s status changes to completed from processing. Then you can download the output file by clicking “Download” button under Output File
_images/batch_5.png
  1. The output file is a semi-colon(;) separated file.
_images/batch_6.png