{ "openapi": "3.0.0", "info": { "title": "Chaos API", "version": "1.0.0" }, "servers": [ { "url": "https://chaos.csesoc.app/api", "description": "Production server" }, { "url": "http://localhost:3000/api", "description": "Local server" } ], "paths": { "/auth/logout": { "post": { "operationId": "logout", "description": "Invalidates current token.", "tags": [ "Auth" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "messages": { "type": "string", "example": "Successfully logged out." } } } } } } } } }, "/user": { "get": { "operationId": "getLoggedInUser", "description": "Returns info about currently logged in user.", "tags": [ "User" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "id": { "type": "integer", "format": "int64", "example": 1541815603606036500 }, "email": { "type": "string", "example": "me@example.com" }, "zid": { "type": "string", "example": "z5555555" }, "name": { "type": "string", "example": "Clancy Lion" }, "degree_name": { "type": "string", "example": "Computer Science" }, "degree_starting_year": { "type": "integer", "example": 2024 }, "role": { "type": "string", "example": "User" } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } } } }, "delete": { "operationId": "deleteUserById", "description": "Deletes currently logged in user.", "tags": [ "User" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully deleted user." } } } } } }, "401": { "description": "Not logged.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } }, "403": { "description": "User is only admin of an organisation.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Cannot delete sole admin of an organisation." } } } } } } } } }, "/user/{id}": { "get": { "operationId": "getUserById", "parameters": [ { "name": "id", "in": "path", "description": "User ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Returns info about specified user.", "tags": [ "User" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "id": { "type": "integer", "format": "int64", "example": 1541815603606036500 }, "email": { "type": "string", "example": "me@example.com" }, "zid": { "type": "string", "example": "z5555555" }, "name": { "type": "string", "example": "Clancy Lion" }, "degree_name": { "type": "string", "example": "Computer Science" }, "degree_starting_year": { "type": "integer", "example": 2024 } } } } } }, "403": { "description": "Requested user has not applied to one of authorized user's campaign.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Insufficient permissions" } } } } } } } } }, "/user/name": { "patch": { "operationId": "updateUserName", "description": "Updates currently logged in user's name.", "tags": [ "User" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "name": { "type": "string", "example": "Clancy Tiger" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully updated name." } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } } } } }, "/user/zid": { "patch": { "operationId": "updateUserZid", "description": "Updates currently logged in user's zID.", "tags": [ "User" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "zid": { "type": "string", "example": "z5123456" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully updated zID." } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } } } } }, "/user/degree": { "patch": { "operationId": "updateUserDegree", "description": "Updates currently logged in user's degree.", "tags": [ "User" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "degree_name": { "type": "string", "example": "Electrical Engineering" }, "degree_starting_year": { "type": "integer", "example": 2024 } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully updated email." } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } } } } }, "/organisation": { "post": { "operationId": "createOrganisation", "description": "Creates a new organisation.", "tags": [ "Organisation" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "name": { "type": "string", "example": "UNSW Software Development Society" }, "admin": { "type": "integer", "format": "int64", "example": 1541815603606036500, "description": "User ID of admin" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully created organisation." } } } } } }, "403": { "description": "User is not a super user.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } }, "/organisation/{id}": { "get": { "operationId": "getOrganisationById", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Returns info about specified organisation.", "tags": [ "Organisation" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "id": { "type": "integer", "format": "int64", "example": 6996987893965263000 }, "name": { "type": "string", "example": "UNSW Software Development Society" }, "logo": { "type": "string", "example": "76718252-2a13-4de2-bc07-f977c75dc52b" }, "created_at": { "type": "string", "example": "2024-02-10T18:25:43.511Z" } } } } } } } }, "delete": { "operationId": "deleteOrganisationById", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Deletes specified organisation.", "tags": [ "Organisation" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully deleted organisation." } } } } } }, "403": { "description": "User is not a super user.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } }, "/organisation/{id}/campaigns": { "get": { "operationId": "getOrganisationCampaignsById", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Returns active campaigns for specified organisation.", "tags": [ "Organisation" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "campaigns": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64", "example": 6996987893965263000 }, "name": { "type": "string", "example": "2024 Subcommittee Recruitment" }, "cover_image": { "type": "string", "example": "2d19617b-46fd-4927-9f53-77d69232ba5d" }, "description": { "type": "string", "example": "Are you excited to make a difference?" }, "starts_at": { "type": "string", "example": "2024-03-15T18:25:43.511Z" }, "ends_at": { "type": "string", "example": "2024-04-15T18:25:43.511Z" } } } } } } } } } } } }, "/organisation/{id}/logo": { "patch": { "operationId": "updateOrganisationLogoById", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Updates logo for specified organistion.", "tags": [ "Organisation" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "upload_url": { "type": "string", "description": "Presigned S3 url to upload file.", "example": "https://presignedurldemo.s3.eu-west-2.amazonaws.com/6996987893965262849/2d19617b-46fd-4927-9f53-77d69232ba5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJWZ7B6WCRGMKFGQ%2F20180210%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20180210T171315Z&X-Amz-Expires=1800&X-Amz-Signature=12b74b0788aa036bc7c3d03b3f20c61f1f91cc9ad8873e3314255dc479a25351&X-Amz-SignedHeaders=host" } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } }, "403": { "description": "User is not an organisation admin.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } }, "/organisation/{id}/members": { "get": { "operationId": "getOrganisationMembersById", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Returns list of members of specified organisation.", "tags": [ "Organisation" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "members": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64", "example": 1541815603606036500 }, "name": { "type": "string", "example": "Clancy Lion" } } } } } } } } }, "403": { "description": "User is not an organisation admin or member.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } }, "put": { "operationId": "updateOrganisationMembersById", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "members": { "type": "array", "uniqueItems": true, "items": { "type": "integer", "format": "int64" }, "example": [ 1541815603606036500, 1541815603606036700, 1541815287306036500 ] } } } } } }, "description": "Specifies members for specified organistion.", "tags": [ "Organisation" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully updated members." } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } }, "403": { "description": "User is not an organisation admin.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } }, "/organisation/{id}/campaign": { "post": { "operationId": "createCampaign", "parameters": [ { "name": "id", "in": "path", "description": "Organisation ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Creates a new campaign inside specified organisation.", "tags": [ "Organisation" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "name": { "type": "string", "example": "2024 Subcommittee Recruitment" }, "description": { "type": "string", "example": "Are you excited to make a difference?" }, "starts_at": { "type": "string", "example": "2024-03-15T18:25:43.511Z" }, "ends_at": { "type": "string", "example": "2024-04-15T18:25:43.511Z" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully created campaign." } } } } } }, "403": { "description": "User is not an admin of specified organisation.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } }, "/campaign": { "get": { "operationId": "getAllCampaigns", "description": "Returns all active campaigns.", "tags": [ "Campaign" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "campaigns": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64", "example": 6996987893965263000 }, "organisation_id": { "type": "integer", "format": "int64", "example": 1541815603606036700 }, "organisation_name": { "type": "string", "example": "UNSW Software Development Society" }, "name": { "type": "string", "example": "2024 Subcommittee Recruitment" }, "cover_image": { "type": "string", "example": "2d19617b-46fd-4927-9f53-77d69232ba5d" }, "description": { "type": "string", "example": "Are you excited to make a difference?" }, "starts_at": { "type": "string", "example": "2024-03-15T18:25:43.511Z" }, "ends_at": { "type": "string", "example": "2024-04-15T18:25:43.511Z" } } } } } } } } } } } }, "/campaign/{id}": { "get": { "operationId": "getCampaignById", "parameters": [ { "name": "id", "in": "path", "description": "Campaign ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Returns info about specified campaign.", "tags": [ "Campaign" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "id": { "type": "integer", "format": "int64", "example": 6996987893965263000 }, "organisation_id": { "type": "integer", "format": "int64", "example": 1541815603606036700 }, "organisation_name": { "type": "string", "example": "UNSW Software Development Society" }, "name": { "type": "string", "example": "2024 Subcommittee Recruitment" }, "cover_image": { "type": "string", "example": "2d19617b-46fd-4927-9f53-77d69232ba5d" }, "description": { "type": "string", "example": "Are you excited to make a difference?" }, "starts_at": { "type": "string", "example": "2024-03-15T18:25:43.511Z" }, "ends_at": { "type": "string", "example": "2024-04-15T18:25:43.511Z" } } } } } } } }, "put": { "operationId": "updateCampaignById", "parameters": [ { "name": "id", "in": "path", "description": "Campaign ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "properties": { "name": { "type": "string", "example": "2024 Subcommittee Recruitment" }, "description": { "type": "string", "example": "Are you excited to make a difference?" }, "starts_at": { "type": "string", "example": "2024-03-15T18:25:43.511Z" }, "ends_at": { "type": "string", "example": "2024-04-15T18:25:43.511Z" } } } } } }, "description": "Updates details of specified campaign.", "tags": [ "Campaign" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully updated campaign." } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } }, "403": { "description": "User is not an organisation admin.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } }, "delete": { "operationId": "deleteCampaignById", "parameters": [ { "name": "id", "in": "path", "description": "Campaign ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Deletes specified campaign.", "tags": [ "Campaign" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "message": { "type": "string", "example": "Successfully deleted campaign." } } } } } }, "403": { "description": "User is not an admin of campaign's organisation.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } }, "/campaign/{id}/banner": { "patch": { "operationId": "updateCampaignBannerById", "parameters": [ { "name": "id", "in": "path", "description": "Campaign ID", "required": true, "schema": { "type": "integer", "format": "int64" } } ], "description": "Updates banner image for specified campaign.", "tags": [ "Campaign" ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "properties": { "upload_url": { "type": "string", "description": "Presigned S3 url to upload file.", "example": "https://presignedurldemo.s3.eu-west-2.amazonaws.com/6996987893965262849/2d19617b-46fd-4927-9f53-77d69232ba5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJWZ7B6WCRGMKFGQ%2F20180210%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20180210T171315Z&X-Amz-Expires=1800&X-Amz-Signature=12b74b0788aa036bc7c3d03b3f20c61f1f91cc9ad8873e3314255dc479a25351&X-Amz-SignedHeaders=host" } } } } } }, "401": { "description": "Not logged in.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Not logged in." } } } } } }, "403": { "description": "User is not an organisation admin.", "content": { "application/json": { "schema": { "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } } } } } } }