# Prayerwatch API Instructions
## Dynamic Queries
This is a constructed way of query the system of the various entities needed on-demand
domain: https://api.prayerwatch.com
```bash=
curl {{domain}}/{{entity}}?...{{query}}
```
|Name|Description|Samples|
|- | - | - |
|domain|The api url|https://prayerwatch-api.herokuapp.com|
|entity|This is the resource meant to be accessed|projects, categories|
|query|This is an object of preset queries|relations, output, range|
### Entity List
|Name|Description|Permissions|
|-|-|-|
|projects|This are prayer projects||
### Query Definition
|Key|Format|Description|Sample Values|
|-|-|-|-|
|relations|`string, string[]`|This are the connections between the other entities|*Depending on the entity*|
|||||
## Platform Queries
Here are the list of all required queries need on the business.
**Note**: All listed queries would be paginated
- Roles of Authentication: `/categories?_categories.name=profiles&ak=_categories`
- List Projects with its prayers & files: `/projects?r=prayers.file`
- List Projects with its comments: `/projects?r=conversation.messages`
- List Public projects (Community Feeds): `/projects`
- List Private projects (Personal): `/projects?0.access=private&1.access=??`
- List Project categories: `/categories?_categories.name=projects&ak=_categories`
- List Files for preview: `/files`
- Load a File for preview: `/files/{id}`
- List Profile projects (Public Only): `/projects?0.profiles.id=??&profiles.id={id}`
- List a Profile archivements: `/profiles/{id}?r=achievements`
- List Relations pending: `/community/relations?status=pending&0._sub=??`
- List Relations accepted (All active): `/community/relations?status=active&0._sub=??`
> Please note **0.\_sub=??** would filter out requests made to you only
- List Consellor: `/profiles?role=counsellor`
- Community: `/community`
These are the list of people on the platform you're which includes there relationships
### Platform Explanation
- Likes & Dislike: These are [content ratings]() can be used on **messages** or **projects**, when quering these entitie ensure to add the relational key ex. /project?**r=rates.owner** to retrieve the rate value alongside the owner. <br> Rate Value:
- love: 2
- like: 1
- indefinate: 0
- dislike: -1
- hate: -2
## Dynamic Actions
To perform direct mutations on-demand
Make use of the **PUT** http method alone with the `id` of the target entity
```bash=
curl -X PUT {{domain}}/{{entity}}/{{id}}
--data '{
"field_to_change": "new data"
}'
```
To perform direct delete on-demand
Make use of the **DELETE** http method alone with the `id` of the target entity
```bash=
curl -X DELETE {{domain}}/{{entity}}/{{id}}
```
:warning: _Becare of this action, cascaded relation might not be restored_
## Platform Actions
Here are the list of all required actions need on the platform.
**Note**: The changes are restricted to your authentication access
- Mark a Prayer as answered
```bash=
curl -X PUT {{domain}}/projects/{{id}}
--data '{
"status": "complete"
}'
```
- Make a Project public
```bash=
curl -X PUT {{domain}}/projects/{{id}}
--data '{
"access": "public"
}'
```
- Update your profile
```bash=
curl -X PUT {{domain}}/profiles/{{id}}
--data '{
"first_name": "john",
"last_name": "doe"
}'
```
* :information_source: Freely modify any field accordingly.
* :warning: These feilds are restricted from modification on Profiles
- email
- status