This tutorial is designed to give you a quickstart on getting to know the system and how to work with it simply by following a step-by-step guideshow you the API and by that get a quick glance of the system.
Table of Contents | ||||
---|---|---|---|---|
|
Prerequisites
There is not a lot that you need to start these first steps, but it includes a computer and some free time!
Additionally some basic knowledge about terminal usage within Linux (Ubuntu) is assumed. You can find some good starter information on the official Ubuntu documentation, although you should be able to copy all the commands from this tuturial and learn on the go!
Installation
See the installation page for instructions on how to install the system and get it running.
Using the API
Prerequisites
Before you ask, API stands for Application Programming Interface, it describes how to use a system and what it can do, for us this is the place to start as it quickly shows you the power of the system!
To use the API we are going to useUsing the API
Prerequisites
Before you ask, API stands for Application Programming Interface, it describes how to use a system and what it can do. For us this is the place to start as it quickly shows you the power of the system! In this tutorial, we are going to use the API to access data about users (e.g. AEGEE members) and bodies (e.g. AEGEE Antennae) in the data base.
To use the API we are going to use a tool called Postman, it is a well-established chrome extension that makes using a REST API a breeze.
If you are using chrome you can find Postman here, if you do not use chrome I suggest you install chrome first otherwise you can find a standalone version here.
Steps to take
- Run the OMS system as instructed in the installation guide
- Fire up postman Check (open Apps of Google Chrome on the top left corner of the browser. If you have installed postman, it should show up here. Otherwise, see above)
- Check to see if the system is running and ready to be used
- Enter the URL to be `localhost`
- Set the method to GET (left of the URL)
- Hit Send!
- Check if the response matches screenshot 1 on the left
- Above the response are buttons: (pretty|raw|preview)
- These change the way the response is viewed
- Press preview
- It should look a little bit better now!
- Above the response are buttons: (pretty|raw|preview)
- Log in as a User
- Change the method to POST
- Change the URL to `localhost/api/login`
- Right below the the URL bar are buttons: (authorization|headers|body|pre-request scripts|tests)
- These are tabs to enter additional request settings.
- Note that the response has similar buttons, yet these are for the response!
- Click the body button (of the request)
- Enter 2 new keys (screenshot 2; it might be necessary to select 'x-www-form-urlencoded')
- key='username', value='admin@aegee.org'
- key='password', value='1234'
- Enter 2 new keys (screenshot 2; it might be necessary to select 'x-www-form-urlencoded')
- Hit send!
- Verify the response looks similar to response 1
- See all the Users
- Open a new tab within Postman
- I like to keep one tab open to quickly be able to login again and get a new token when needed
- Set the method to GET
- Set the URL to `localhost/api/users`
- Open the request Header tab
- Enter a new key
- key='X-Auth-Token', value='yourlogintokenenteranynumber'
- Enter a new key
- Hit send!
- You should get a forbidden message
- Enter the correct login token
- Go back to your login request
- Copy the value with the key "data"
- In the example response this is `da78dbb0-6ff4-11e7-bb7e-476b0d476473`
- Paste it in the value for the X-Auth-Token
- Hit Send again!
- Check if the response equals response 2
- Open a new tab within Postman
- See your User
- Keep the GET method
- Keep the X-Auth-Token
- Change the URL to 'localhost/api/users/1'
- Hit Send!
- Check if the response equals response 3
- Create a UsersBody
- Set the method to POST
- Set the URL back to 'localhost/api/bodies'
- Hit Send!
- Check the errors you got
- Go to the Body tab of the request and enter the following keys
- key='type_id', value='1'
- key='address_id', value='1'
- key='name', value='yourfavouritelocal'
- key='email', value='yourfavouriteemailaddress'
- Hit Send!
- Check if your response is similar to response 4
- Check all the Bodies
- Try finding this out yourself!
- Check the rest of the API
- '
- key='email', value='yourfavouriteemailaddress'
- Hit Send!
- Check if your response is similar to response 4
- Check all the Bodies
- Try finding this out yourself!
- Check the rest of the API. In the documentation you will find instructions on how to do what we just did already, and more. Mind: in the documentation it will say "http://oms.apiblueprint.org" instead of 'localhost'. You have to replace this, either by 'localhost' or by 'oms.aegee.org' to contact the right system.
Screenshot 1 - Postman
Screenshot 2 - Postman//login
Code Block | ||||
---|---|---|---|---|
| ||||
{ "success": true, "meta": null, "data": "da78dbb0-6ff4-11e7-bb7e-476b0d476473", "message": "User login token" } |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "success": true, "meta": null, "data": [ { "id": 2, "address_id": 2, "personal_email": "derk.snijders@aegee.org", "first_name": "Derk", "last_name": "Snijders", "date_of_birth": "1993-10-31 00:00:00", "gender": "male", "phone": null, "description": null, "remember_token": null, "is_superadmin": 1, "is_suspended": null, "suspended_reason": null, "seo_url": "i3anaan", "activated_at": "2017-07-18 10:13:06", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06", "internal_email": "derk.snijders@aegee.eu", "first_name_simple": "Derk", "last_name_simple": "Snijders" }, { "id": 3, "address_id": 1, "personal_email": "nico.westerbeck@aegee.org", "first_name": "Nico", "last_name": "Westerbeck", "date_of_birth": "1985-04-16 00:00:00", "gender": "male", "phone": null, "description": null, "remember_token": null, "is_superadmin": 0, "is_suspended": null, "suspended_reason": null, "seo_url": "blacksph3re", "activated_at": "2017-07-18 10:13:06", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06", "internal_email": null, "first_name_simple": "Nico", "last_name_simple": "Westerbeck" }, { "id": 4, "address_id": 1, "personal_email": "sergey.peshkov@aegee.org", "first_name": "Sergey", "last_name": "Peshkov", "date_of_birth": "1985-04-16 00:00:00", "gender": "male", "phone": null, "description": null, "remember_token": null, "is_superadmin": 0, "is_suspended": null, "suspended_reason": null, "seo_url": "sergey.peshkov", "activated_at": "2017-07-18 10:13:06", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06", "internal_email": null, "first_name_simple": "Sergey", "last_name_simple": "Peshkov" }, { "id": 5, "address_id": 1, "personal_email": "fabrizio.bellicano@aegee.org", "first_name": "Grace", "last_name": "Hopper", "date_of_birth": "1985-04-16 00:00:00", "gender": "female", "phone": null, "description": null, "remember_token": null, "is_superadmin": 0, "is_suspended": null, "suspended_reason": null, "seo_url": "gracehopper", "activated_at": "2017-07-18 10:13:07", "created_at": "2017-07-18 10:13:07", "updated_at": "2017-07-18 10:13:07", "internal_email": null, "first_name_simple": "Grace", "last_name_simple": "Hopper" }, { "id": 6, "address_id": 1, "personal_email": "headoffice@aegee.org", "first_name": "Big", "last_name": "Boobs", "date_of_birth": "1998-04-16 00:00:00", "gender": "female", "phone": null, "description": null, "remember_token": null, "is_superadmin": 0, "is_suspended": null, "suspended_reason": null, "seo_url": "boobies", "activated_at": "2017-07-18 10:13:07", "created_at": "2017-07-18 10:13:07", "updated_at": "2017-07-18 10:13:07", "internal_email": null, "first_name_simple": "Big", "last_name_simple": "Boobs" }, { "id": 1, "address_id": 1, "personal_email": "admin@aegee.org", "first_name": "Super", "last_name": "Admin", "date_of_birth": "1985-04-16 00:00:00", "gender": "other", "phone": null, "description": null, "remember_token": "whFezyRDtQV1zRvgoh3rxbKarI39fDObmKiRmPDFDQwjfnhP1xZ9nXVkD8NE", "is_superadmin": 1, "is_suspended": null, "suspended_reason": null, "seo_url": "superadmin", "activated_at": "2017-07-18 10:13:06", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06", "internal_email": null, "first_name_simple": "Super", "last_name_simple": "Admin" } ], "message": null } |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "success": true, "meta": null, "data": { "id": 1, "address_id": 1, "personal_email": "admin@aegee.org", "first_name": "Super", "last_name": "Admin", "date_of_birth": "1985-04-16 00:00:00", "gender": "other", "phone": null, "description": null, "remember_token": "whFezyRDtQV1zRvgoh3rxbKarI39fDObmKiRmPDFDQwjfnhP1xZ9nXVkD8NE", "is_superadmin": 1, "is_suspended": null, "suspended_reason": null, "seo_url": "superadmin", "activated_at": "2017-07-18 10:13:06", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06", "internal_email": null, "first_name_simple": "Super", "last_name_simple": "Admin", "address": { "id": 1, "country_id": 21, "street": "Notelaarsstraat 55", "zipcode": "1000", "city": "Brussels", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06" }, "bodies": [ { "id": 1, "type_id": 2, "address_id": 1, "name": "AEGEE-Europe", "email": "headoffice@aegee.org", "phone": null, "description": null, "legacy_key": "AEU", "created_at": "2017-07-18 10:13:06", "updated_at": "2017-07-18 10:13:06", "name_simple": "AEGEE-Europe", "pivot": { "user_id": 1, "body_id": 1 } } ], "circles": [ { "id": 4, "body_id": 4, "parent_id": 1, "name": "Lia & Derk", "description": "IT people in da house", "created_at": "2017-07-18 10:13:07", "updated_at": "2017-07-18 10:13:07", "name_simple": "Lia & Derk", "pivot": { "user_id": 1, "circle_id": 4 } } ] }, "message": null } |
Response 4
Jira Legacy | ||||||||
---|---|---|---|---|---|---|---|---|
|