Skip to content

Consuming the API

Adam Juhos edited this page Apr 10, 2017 · 2 revisions

You can use curl or Postman to test your API.

1. Create entries

First create a user:

 $ curl --request POST \
 $      --url http://localhost/users \
 $      --header 'accept: application/json' \
 $      --header 'content-type: application/json' \
 $      --data '{ "name": "Test 1" }'

You will receive the created user as the response:

{ "id": "xyz", "name": "Test 1" }

Second create an entry:

 $ curl --request POST \
 $      --url http://localhost/users \
 $      --header 'accept: application/json' \
 $      --header 'content-type: application/json' \
 $      --data '{ "owner": "xyz", "name": "Entry 1", "value": "Something" }'

2. Query entries

First query the users:

 $ curl --request GET \
 $      --url http://localhost/users

As the response you will receive the list of users:

[
    { "id": "xyz", "name": "Test 1" }
]

Now get the entries of our user:

 $ curl --request GET \
 $      --url http://localhost/users/xyz/entries

As the response you will receive the list of entries of the user:

[
    { "id": "abc", "owner": "xyz", "name": "Entry 1", "value": "Something" }
]

You can learn more about the REST interface at the High level access page.

3. Continue your journey!

This is the end of the Getting started section. Now you can create basic APIs, to learn more, read the remaining sections of the wiki. Have fun!

Clone this wiki locally