Handle arguments (GET, POST, JSON)

Published at: April 4, 2018, 3:35 p.m. in the Documentation

Smappi supports several options for passing arguments to API functions. We tried to think through all the most convenient ways to deliver arguments, so you do not have to write adapters for us. If you did not find a convenient way, then write your requirements in a letter to api@smappi.org

Important! We recommend that you send all requests only through HTTPS.

Below we will consider examples based on this code:

Through GET

First of all, we support GET:

curl "https://json.smappi.org/adw0rd/example/greeting?name=friend"
"Hello, friend!"

Through POST

Just as GET Smappi also supports POST:

curl --data "name=friend" https://json.smappi.org/adw0rd/example/greeting
"Hello, friend!"

Sending JSON

If it is convenient for you to send JSON right away, then we have foreseen this:

curl -H "Content-Type: application/json" --data '{"name": "friend"}' https://json.smappi.org/adw0rd/example/greeting
"Hello, friend!"

Operator ...spread

If you use spreads, you must specify the spread name as an argument:

curl --data "digits=1,1,2,2,3,3,4,5,6,7,8" https://json.smappi.org/adw0rd/example/calculator
42