Sample project using the sapim library
This is a simple JSON form validator API proxy definition built with the SAP API Manager Tools.
You should have node-js
and npm
installed.
To deploy the proxy on your own API Manager account:
git clone
the repositorynpm install
- setup the sapim configuration
npm run deploy
With valid input:
curl -X POST \
https://your-api-management.host.com/sample \
-H 'Content-Type: application/json' \
-d '{
"name": "Spet",
"email": "something@example.com",
"address": {
"city": "Cluj",
"street": "Brassai"
}
}'
{
"result": "ok"
}
With invalid input:
curl -X POST \
https://your-api-management.host.com/sample \
-H 'Content-Type: application/json' \
-d '{
"name": "Spet",
"email": "not-an-email",
"address": {
"city": "Cluj"
}
}'
[
{
"message": "Email must be valid.",
"path": "email"
},
{
"message": "Street is required.",
"path": "address.street"
}
]