Example: how to View stories using the API

A story on Makerble is composed of several components which need to be assembled with several API calls in order to see the whole story.

Introduction

Watch this walkthrough video of what a story is. It covers:

  • How to create a story

  • How to view a story

https://www.loom.com/share/8542bd5e2a5f4a05b676f2a27dc9a29f

Components of a story

 

API calls and responses

Step

Postman call

Postman response

Step

Postman call

Postman response

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==" }

 

Stories

/api/v2/stories?page=22&per_page=2

 

{ "page": 22, "page_size": 2, "page_count": 37, "total_count": 73, "data": [ { "id": 369143, "text": null, "number": "0", "approved": true, "story_group": "change_created", "location": null, "project_id": 3951, "charity_id": null, "story_category_id": 6078, "edited_by": 3417, "user_id": 3417, "updated_at": "2023-11-06T13:33:23.552+00:00", "created_at": "2023-11-06T13:33:22.000+00:00", "actual_created_at": "2023-11-06T13:33:22.984+00:00", "beneficiary_ids": [ 147427 ], "custom_fields": [ { "id": 4776, "name": "this is a test question", "type": "text", "value": "07:02 PM its a public survey" }, { "id": 4779, "name": "this is another text question", "type": "text", "value": "gdsgdgdagfdagf" } ] } ] }

single story

/api/v2/stories/:id

 

{ "id": 368376, "text": null, "number": "0", "approved": true, "story_group": "change_created", "location": null, "project_id": 3914, "charity_id": null, "story_category_id": 1007, "edited_by": 1318, "user_id": 1318, "updated_at": "2023-10-06T14:16:21.703+01:00", "created_at": "2023-10-06T14:16:20.000+01:00", "actual_created_at": "2023-10-06T14:16:20.859+01:00", "beneficiary_ids": [ 146211 ], "case_ids": [], "custom_fields": [ { "id": 53, "name": "Date of birth", "type": "text", "value": "21/01/1986" }, { "id": 434230, "beneficiary_id": 146211, "indicator_id": 1619, "indicator_type": "binary" } ], "story_indicator_beneficiaries": [ { "id": 434199, "beneficiary_id": 146211, "indicator_id": 1588, "indicator_type": "scale", "sub_ratio_id": 1359, "outcome_id": 925 }, { "id": 434200, "beneficiary_id": 146211, "indicator_id": 1589, "indicator_type": "scale", "sub_ratio_id": 1359, "outcome_id": null } ], "story_change_beneficiaries": [], "story_changes": [] }

Story attachments

 

 

Â