Skip to content

Street Art Orlando API Documentation

Axel Rivera edited this page Sep 6, 2018 · 5 revisions

Base URL

Staging: https://sao-api-staging.herokuapp.com/api
Production: https://sao-api.herokuapp.com/api

Default Headers

Accept = application/json
Content-Type = application/json
Authorization = [AUTH_TOKEN] // Used in Authenticated Endpoints

Registration

Register new user.

POST /users/register

Parameters (JSON Body)

  • name - Name String (optional)
  • email - Valid Email String (required)
  • password - Password String (required)

Response

Response Code: 201

{ "success": true }

Authentication

Login

User login.

POST /authenticate

Parameters (JSON Body)

  • email - Email String (required)
  • password - Password String (required)

Response

Response Code: 200

{
  "auth_token": "auth_token_string"
}

Update Password

Change user password while user is authenticated.

Authenticated: true

PUT /password/update

Parameters (JSON Body)

  • password - Password (required)

Password Reset

Forgot Password

Used to reset a user's password if forgotten. This flow works when the user is not authenticated. Sends an email to the user with 6 digit validation code.

POST /password/forgot

Parameters (JSON Body)

  • email - User's email (required)

Response

Response Code: 200

{
  "success": true,
  "message": "A security code will be sent to you via email shortly."
}

Validate Password Token

Validates 6 digit code that was received by email. Code expires in 4 hours.

POST /password/vaidate_token

Parameters (JSON Body)

  • email - User's email (required)
  • token - Validation Token (required)

Response

Response Code: 200

{ "success": true }

Password Reset

Allows user to create a password after validating the 6 digit code.

POST /password/reset

Parameters (JSON Body)

  • email - User's email (required)
  • token - Validation Token (required)
  • password - New Passwork (required)

Response

Response Code: 200

{ "success": true }

Submissions

Fetch Submissions

Fetch all submissions available (sorted by latest first). Does not require authentication. This endpoint is paginated.

GET /submissions

Parameters (URL Query)

  • page - Page Number (i.e. 1,2,3); Empty Responds First Page

Response

Response Code: 200

{
  "submissions": [
    {
      "id": 1,
      "status": "approved",
      "title": "Title String (Optional)",
      "description": "Description Text (Optional)",
      "photo_url": "https://street-art-orlando-images-staging.s3.amazonaws.com/uploads/submission/photo/1/display_photo.jpeg",
      "thumb_url": "https://street-art-orlando-images-staging.s3.amazonaws.com/uploads/submission/photo/1/thumb_photo.jpeg",
      "tiny_url": "https://street-art-orlando-images-staging.s3.amazonaws.com/uploads/submission/photo/1/tiny_photo.jpeg",
      "artist": "Artist Name (Optional)",
      "location_note": "Location Note (Optional)",
      "created_at": "2018-09-05T16:07:37.760Z",
      "favorite": false,
      "latitude": 18.34008,
      "longitude": -66.099282
    }
  ],
  "meta": {
    "current_page": 1,
    "next_page": null,
    "total": 1,
    "total_pages": 1
  }
}

Upload Submission

Upload a submission to the API backend server. Content is moderated for non VIP users.

Authenticated: true

POST /submissions

Parameters (JSON Body)

  • photo - Image in Base64 String Format (required)
  • title - Title String (optional)
  • artist - Artist String (optional)
  • location_note - Location Note String (optional)
  • latitude - Latitude Decimal (required)
  • longitude - Longitude Decimal (required)

Response

Status Code: 202

{ "success": true }

My Submissions

Fetch submissions that belong to the current user. This endpoint is not paginated and may only respond with a partial list of submissions.

Authenticated: true

GET /submissions/mine

Response

Response Code: 200

{
  "submissions": [
    {
      "id": 1,
      "status": "approved",
      "title": "Title String (Optional)",
      "description": "Description Text (Optional)",
      "photo_url": "https://street-art-orlando-images-staging.s3.amazonaws.com/uploads/submission/photo/1/display_photo.jpeg",
      "thumb_url": "https://street-art-orlando-images-staging.s3.amazonaws.com/uploads/submission/photo/1/thumb_photo.jpeg",
      "tiny_url": "https://street-art-orlando-images-staging.s3.amazonaws.com/uploads/submission/photo/1/tiny_photo.jpeg",
      "artist": "Artist Name (Optional)",
      "location_note": "Location Note (Optional)",
      "created_at": "2018-09-05T16:07:37.760Z",
      "favorite": false,
      "latitude": 18.34008,
      "longitude": -66.099282
    }
  ]
}

My Favorites

Fetch all favorites that belong to a user. Not paginated.

Authenticated: true

GET /submissions/favorites

Response

Response Code: 200

{
  "submissions": [
    {
      "id": 12,
      "status": "approved",
      "title": "This is a Title",
      "description": "",
      "photo_url": "https://street-art-orlando-images-dev.s3.amazonaws.com/uploads/submission/photo/12/display_20180829_134348.jpg",
      "thumb_url": "https://street-art-orlando-images-dev.s3.amazonaws.com/uploads/submission/photo/12/thumb_20180829_134348.jpg",
      "tiny_url": "https://street-art-orlando-images-dev.s3.amazonaws.com/uploads/submission/photo/12/tiny_20180829_134348.jpg",
      "artist": "Artist Wow",
      "location_note": "Next to 7 Eleven",
      "created_at": "2018-08-29T02:31:30.923Z",
      "favorite": true,
      "latitude": 28.55181,
      "longitude": -81.37978
    },
    {
      "id": 2,
      "status": "approved",
      "title": "Stardust Planet",
      "description": "",
      "photo_url": "https://street-art-orlando-images-dev.s3.amazonaws.com/uploads/submission/photo/2/display_photo.jpeg",
      "thumb_url": "https://street-art-orlando-images-dev.s3.amazonaws.com/uploads/submission/photo/2/thumb_photo.jpeg",
      "tiny_url": "https://street-art-orlando-images-dev.s3.amazonaws.com/uploads/submission/photo/2/tiny_photo.jpeg",
      "artist": "",
      "location_note": "",
      "created_at": "2018-07-28T22:02:50.799Z",
      "favorite": true,
      "latitude": 28.568397,
      "longitude": -81.346375
    }
  ]
}

Add Favorite

Favorite Submission.

Authenticated: true

POST /submissions/:id/favorite

Parameters (URL)

  • id - Submission ID

Response

Response Code: 204

No Content

Remove Favorite

Unfavorite Submission.

Authenticated: true

DELETE /submissions/:id/unfavorite

Parameters (URL)

  • id - Submission ID

Response

Response Code: 204

No Content

Errors

  • Errors may be client side 4xx or server side 5xx.

Client Side Errors

Client side errors may in some cases include a payload with messages that can be displayed to the user in an alert.

Single Error Message

{
  "error": "Error Message"
}

Multiple Error Messages

{
  "errors": [
    "Error Message 1",
    "Error Message 2"
  ]
}