· View as Markdown

Photos

Upload a photo to use it in an experience guide page.

See also: Publish a multi-day tour.

Uploads a photo

POST /api/v1/photos.json

Uploads an image and returns the new photo. Use its id wherever a photo id is expected.

Multipart uploads: This endpoint accepts only Content-Type: multipart/form-data. Send the image in the file field.

The photo has no parent and belongs to the authenticated user. A photo that is not used anywhere is deleted 24 hours after upload.

Headers

  • x-rwgps-api-key string required
    API key for identifying the client application
  • x-rwgps-auth-token string required
    Authentication token for the user

Request body multipart/form-data

  • file file required
    Image file

Response 201

  • photo object
    12 fields
    • id integer
    • url string
    • highlighted boolean
    • caption string or null
    • lat number or null
    • lng number or null
    • elevation integer or null
    • location string or null
    • locality string or null
    • administrative_area string or null
    • country_code string or null
    • created_at date-time

Errors

  • 400 Not an image
  • 401 Unauthorized
Request
curl \
  -H "x-rwgps-api-key: $API_KEY" \
  -H "x-rwgps-auth-token: $AUTH_TOKEN" \
  -X POST \
  -F file=@route.gpx \
  https://ridewithgps.com/api/v1/photos.json
Response 201
{
  "photo": {
    "id": 123,
    "url": "https://ridewithgps.com/api/v1/photos/123/8275d8de285be31d7b2437bc3ae69756.jpg",
    "highlighted": false,
    "caption": "View from Pittock Mansion",
    "lat": 45.521529,
    "lng": -122.691804,
    "elevation": 290,
    "location": "Pittock Mansion",
    "locality": "Portland",
    "administrative_area": "OR",
    "country_code": "US",
    "created_at": "2000-01-01T12:00:00Z"
  }
}