Example: how to create Beneficiaries using the API
This example includes the steps of
step | postman call | postman response | content in front-end |
---|---|---|---|
STEP 1: login | POST http://localhost:3000/api/v2/users/sign_in?user[email]=soft.dave99@gmail.com&user[password]=123456 | {
"user_id": 368,
"email": "soft.dave99@gmail.com",
"authentication_token": "vB4J9TJMLGnZnV4DMZlvPTWimman1gxpo2AoechN--8EELxNTE4I6Ih5Aa--dmDINUcdLkimLXnlrnKJhA=="
}
|
|
STEP 2: get beneficiary categories (this gives you the different Forms that can be used to create a beneficiary. Each form is called a Beneficiary Category) |
GET header: {'X-User-Token': 'Ppteex1dWbEcnNC311NFOrJqNHP98zN2ccMpWEei--ixL50J7uZsnprbOu--WbOcz50zaS48JzyXXZHS9A==', |
| manage beneficiary categories page
|
STEP 3: get custom fields from a beneficiary category (This gives you the fields within the beneficiary category, i.e. the text fields, number fields, date fields, time fields, section dividers, attachment field and ratio sets (list fields)) | GET |
|
|
STEP 4: get sub ratios from a ratio set
(These are the answer choices within a list field from there beneficiary category. For example if one of the field on the form is “what is your sex?”, That field will be a Ratio Set and the answer choices within it of Male and Female will be there SubRatios of that Ratio Set) | GET |
|
|
STEP 5: Ratio Set Choiceable
(This determines whether the list field is unlimited multiple choice, limited multiple choice or single choice) | GET header: {'X-User-Token': 'Ppteex1dWbEcnNC311NFOrJqNHP98zN2ccMpWEei--ixL50J7uZsnprbOu--WbOcz50zaS48JzyXXZHS9A==', |
|
|
STEP 6: create beneficiary | POST
|
| create beneficiary page - using that beneficiary category |
STEP 7: show beneficiary | GET |
| beneficiary profile page
|