From e77688386f2660bcf8cd3773cd4834562e6b9d11 Mon Sep 17 00:00:00 2001 From: Amy Schools Date: Tue, 25 Oct 2016 11:42:48 -0700 Subject: [PATCH] fixed errors from first edit --- blueprint/api.apib | 287 ++++++++++++++++++++++----------------------- 1 file changed, 139 insertions(+), 148 deletions(-) diff --git a/blueprint/api.apib b/blueprint/api.apib index 7e4bd5684..d60800624 100644 --- a/blueprint/api.apib +++ b/blueprint/api.apib @@ -15,133 +15,6 @@ The staging API can be found at `http://api.pbqrpbecf.org`. The remote development API can be found at `http://api.pbqrpbecf-qri.org`. - -# DonationGoals [/donation-goals] - -This resource allows a Project to raise a set amount of money(in cents, i.e. 1000 cents = $10 USD). It is one of several donation goals a project is allowed to have. A project cannot create a donation goal until they have started accepting payment with Stripe. - - -## DonationGoal Attributes (object) -+ title: `Support the core team` (required, string) -+ description: `Will provide all the basic overhead costs needed to run Code Corps.` (required, string) - Several lines describing the reasons for the goal -+ amount: 1500000 (required, number) - The amount, in cents, for the goal. -+ current: true (required, boolean) - Indicates whether this is the current donation goal. This is determined by whether 1) this is the highest goal and the total monthly raised is higher than that amount or 2) the total monthly raised is between the lower goal's amount (if it exists) and this goal's amount. - - - -### Create a DonationGoal [POST] -To create a Donation Goal the user must be a site admin or the owner of the referenced project. - -+ Request - - + Headers - - Accept: application/vnd.api+json - Authorization: Bearer {token} - - + Attributes (DonationGoal Create Request) - -+ Response 201 (application/vnd.api+json; charset=utf-8) - - + Attributes (title, description, amount, current) - -+ Response 422 (application/vnd.api+json; charset=utf-8) - - + Attributes (Unprocessable Entity Response) - - -### Update a DonationGoal [PATCH] -To update a Donation Goal the user must be a site admin or the owner of the referenced project. - -+ Request - - + Headers - - Accept: application/vnd.api+json - Authorization: Bearer {token} - -+ Response 201 (application/vnd.api+json; charset=utf-8) - - + Attributes (DonationGoal Response) - -+ Response 403 (application/vnd.api+json; charset=utf-8) - - + Attributes (Forbidden Response) - -+ Response 404 (application/vnd.api+json; charset=utf-8) - - + Attributes (Record Not Found Response) - - -### Delete a donation goal from a project [DELETE] -To update a Donation Goal the user must be a site admin or the owner of the referenced project. - -+ Parameters - - + id (number) - The `id` of a donation goal. - -+ Request - - + Headers - - Accept: application/vnd.api+json - Authorization: Bearer {token} - -+ Response 204 (application/vnd.api+json; charset=utf-8) - - + Attributes (No Content Response) - -+ Response 401 (application/vnd.api+json; charset=utf-8) - - + Attributes (JSON Web Token Invalid Response) - -+ Response 403 (application/vnd.api+json; charset=utf-8) - - + Attributes (Forbidden Response) - - -### Retrieve a DonationGoal [GET] - -+ Request - - + Headers - - Accept: application/vnd.api+json - -+ Response 200 (application/vnd.api+json; charset=utf-8) - - + Attributes (DonationGoal Response) - - -# Donation Goal Relationships - This resource identifies the relationship between a DonationGoal, which belongs to a project. A project can have more than one donation goal. - -## DonationGoal Relationship (object) - + data - + project_id (number) - Id of a project. - + id (number) - The `id` of a donation goal. - -### Retrieve All DonationGoals for a Project [GET] - -+ Parameters - - + project_id (number) - Id of a project. - + id (number) - The `id` of a donation goal. - -+ Request - - + Headers - - Accept: application/vnd.api+json - -+ Response 200 (application/vnd.api+json; charset=utf-8) - - + Attributes (DonationGoals Response) - -+ Response 404 (application/vnd.api+json; charset=utf-8) - - + Attributes (Record Not Found Response) - # Group Authentication When using the API's authenticated endpoints you can authenticate users by exchanging the `username` (email address) and `password` for a JSON Web Token. @@ -406,6 +279,126 @@ You can list all comments or retrieve individual comments, as well as create and + Attributes (Unprocessable Entity Response) +# Group Donation Goals + +This resource allows a Project to raise a set amount of money(in cents, i.e. 1000 cents = $10 USD). It is one of several donation goals a project is allowed to have. A project cannot create a donation goal until they have started accepting payment with Stripe. + +## Donation goals [/donation-goals] + +### Create a donation goal [POST] + +To create a Donation Goal the user must be a site admin or the owner of the referenced project. + ++ Request + + + Headers + + Accept: application/vnd.api+json + Authorization: Bearer {token} + ++ Response 201 (application/vnd.api+json; charset=utf-8) + + + Attributes (Donation Goal Response) + ++ Response 422 (application/vnd.api+json; charset=utf-8) + + + Attributes (Unprocessable Entity Response) + +### List all donation goals for a project [GET] + ++ Parameters + + + project_id (number) - Id of a project. + + id (number) - The `id` of a donation goal. + ++ Request + + + Headers + + Accept: application/vnd.api+json + ++ Response 200 (application/vnd.api+json; charset=utf-8) + + + Attributes (Donation Goals Response) + ++ Response 404 (application/vnd.api+json; charset=utf-8) + + + Attributes (Record Not Found Response) + +## Donation Goal [/donation-goals/{id}] + +### Retrieve a donation goal [GET] + ++ Request + + + Headers + + Accept: application/vnd.api+json + ++ Response 200 (application/vnd.api+json; charset=utf-8) + + + Attributes (Donation Goal Response) + +### Update a donation goal [PATCH] + +To update a Donation Goal the user must be a site admin or the owner of the referenced project. + ++ Request + + + Headers + + Accept: application/vnd.api+json + Authorization: Bearer {token} + ++ Response 201 (application/vnd.api+json; charset=utf-8) + + + Attributes (Donation Goal Response) + ++ Response 403 (application/vnd.api+json; charset=utf-8) + + + Attributes (Forbidden Response) + ++ Response 404 (application/vnd.api+json; charset=utf-8) + + + Attributes (Record Not Found Response) + + +### Delete a donation goal from a project [DELETE] + +To update a Donation Goal the user must be a site admin or the owner of the referenced project. + ++ Parameters + + + id (number) - The `id` of a donation goal. + ++ Request + + + Headers + + Accept: application/vnd.api+json + Authorization: Bearer {token} + ++ Response 204 (application/vnd.api+json; charset=utf-8) + + + Attributes (No Content Response) + ++ Response 401 (application/vnd.api+json; charset=utf-8) + + + Attributes (JSON Web Token Invalid Response) + ++ Response 403 (application/vnd.api+json; charset=utf-8) + + + Attributes (Forbidden Response) + +# Donation Goal Relationships + +This resource identifies the relationship between a Donation goal, which belongs to a project. A project can have more than one donation goal. + +## Donation goal Relationship (object) + + data + + project_id (number) - Id of a project. + + id (number) - The `id` of a donation goal. + # Group Organization Memberships ## Organization Memberships [/organization-memberships] @@ -1858,7 +1851,7 @@ This endpoint allows you to check whether a username is valid (by running a vali ## Comment Resource (object) + include Comment Resource Identifier + attributes(Comment Attributes) -+ relationships ++ relaptionships + task + data(Task Resource Identifier) + user @@ -1905,34 +1898,33 @@ This endpoint allows you to check whether a username is valid (by running a vali + id: 1 (string) + type: `comment` (string, required) +## Donation Goal Resource (object) ++ include Donation Goal Resource Identifier ++ relationships + + project + + data(Project Resource Identifier) - - - - - - -************************ - - - - -## DonationGoal Resource Identifier +## Donation Goal Resource Identifier + id: `1` (string, required) + type: `donation-goal` (string, required) -##DonationGoal Response -+ data(DonationGoal) Resource) +## Donation goal Attributes (object) ++ title: `Support the core team` (required, string) ++ description: `Will provide all the basic overhead costs needed to run Code Corps.` (required, string) - Several lines describing the reasons for the goal ++ amount: `1500000` (required, number) - The amount, in cents, for the goal. ++ current: `true` (required, boolean) - Indicates whether this is the current donation goal. This is determined by whether 1) this is the highest goal and the total monthly raised is higher than that amount or 2) the total monthly raised is between the lower goal's amount (if it exists) and this goal's amount. + +## Donation Goal Response (object) ++ data(Donation Goal Resource) + include JSON API Version -##DonationGoals Response (object) -+ data(array[Organization Resource]) +## Donation Goals Response (object) ++ data(array[Donation Goal Resource]) + include JSON API Version -## DonationGoal Create Request +## Donation Goal Create Request + data + attributes - + base64_icon_data (string) - A base64 encoded string containing the project icon + title (string) - A title for the donation + description (string) - A short plain text description for the donation + amount (number) - the amount of money in cents for the goal @@ -1941,10 +1933,9 @@ This endpoint allows you to check whether a username is valid (by running a vali + project + data(Project Resource Identifier) - Identifier of project this donation goal is being created for -## DonationGoal Update Request +## Donation Goal Update Request + data + attributes - + base64_icon_data (string) - A base64 encoded string containing the project icon + title (string) - A title for the donation + description (string) - A short plain text description for the donation + amount (number) - the amount of money in cents for the goal