Resources

Resource Photos

/api/nodes/{node_id}/photos?page&per_page

/api/user/photos?page&per_page

Methods

GET

Retrieve a collection of photos. This resource is always nested under a user or node url, to just return the photos associated with the given node or the current user. See examples

request query parameter
Parameter Type Description
page integer For pagination, what page of the results you are on. Default is 1.
per_page integer For pagination, how many results to return per page. Default is 200. Max is 500.

Example request to get all photos of the current user

http://wheelmap.org/api/user/photos?api_key=api_key&per_page=6

Example request to get all photos of the given node

http://wheelmap.org/api/nodes/1/photos?api_key=api_key&per_page=6

Representations

Example photos representation. (application/json)

{
    "conditions": {
        "page": 1,
        "per_page": 200,
        "locale": null,
        "format": "json"
    },
    "meta": {
        "page": 1,
        "item_count": 2,
        "item_count_total": 2,
        "num_pages": 1
    },
    "photos": [
        {
            "id": 1,
            "taken_on": 1353678018,
            "images": [
                {
                    "type": "original",
                    "width": 4288,
                    "height": 2848,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/original.jpg?1353426904"
                },
                {
                    "type": "gallery",
                    "width": 600,
                    "height": 400,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/gallery.jpg?1353426904"
                },
                {
                    "type": "gallery_iphone",
                    "width": 480,
                    "height": 320,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/gallery_iphone.jpg?1353426904"
                },
                {
                    "type": "gallery_iphone_retina",
                    "width": 960,
                    "height": 640,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/gallery_iphone_retina.jpg?1353426904"
                },
                {
                    "type": "gallery_ipad",
                    "width": 1024,
                    "height": 680,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/gallery_ipad.jpg?1353426904"
                },
                {
                    "type": "gallery_ipad_retina",
                    "width": 2048,
                    "height": 1350,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/gallery_ipad_retina.jpg?1353426904"
                },
                {
                    "type": "thumb",
                    "width": 100,
                    "height": 100,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/thumb.jpg?1353426904"
                },
                {
                    "type": "thumb_iphone",
                    "width": 80,
                    "height": 56,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/thumb_iphone.jpg?1353426904"
                },
                {
                    "type": "thumb_iphone_retina",
                    "width": 160,
                    "height": 112,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/155/thumb_iphone_retina.jpg?1353426904"
                }
            ]
        },
        {
            "id": 2,
            "taken_on": 1353672018,
            "images": [
                {
                    "type": "original",
                    "width": 4288,
                    "height": 2848,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/original.jpg?1353426905"
                },
                {
                    "type": "gallery",
                    "width": 600,
                    "height": 400,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/gallery.jpg?1353426905"
                },
                {
                    "type": "gallery_iphone",
                    "width": 480,
                    "height": 320,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/gallery_iphone.jpg?1353426905"
                },
                {
                    "type": "gallery_iphone_retina",
                    "width": 960,
                    "height": 640,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/gallery_iphone_retina.jpg?1353426905"
                },
                {
                    "type": "gallery_ipad",
                    "width": 1024,
                    "height": 680,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/gallery_ipad.jpg?1353426905"
                },
                {
                    "type": "gallery_ipad_retina",
                    "width": 2048,
                    "height": 1360,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/gallery_ipad_retina.jpg?1353426905"
                },
                {
                    "type": "thumb",
                    "width": 100,
                    "height": 100,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/thumb.jpg?1353426905"
                },
                {
                    "type": "thumb_iphone",
                    "width": 80,
                    "height": 56,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/thumb_iphone.jpg?1353426905"
                },
                {
                    "type": "thumb_iphone_retina",
                    "width": 160,
                    "height": 80,
                    "url": "http://asset0.staging.wheelmap.org/system/uploads/photo/000/000/156/thumb_iphone_retina.jpg?1353426905"
                }
            ]
        }
    ]
}

/api/nodes/{node_id}/photos

Methods

POST

Upload a new Photo for the given node. NOTE: This post must be submitted as a multipart Request, as the payload does not fit into one packet. The Content-Type can be either: "image/jpg", "image/gif", "image/png" or "image/tif"

See the following links how it is done on Android and iOS Devices:

Upon upload the image is processed on the server. This is done asynchronously. So it might take some time.

request query parameter

Example request:

http://wheelmap.org/api/nodes/123/photos?api_key=api_key
Parameter Type Description
photo* file The photo you want to upload. This must be part of the HTTP Multipart POST Body.

Example photo representation. (application/json)

{"message":"OK"}

/api/nodes/{node_id}/photos/{photo_id}

Methods

DELETE

Delete a photo for the given node or user. NOTE: The photo and all resized version are deleted immidiately. THERE IS NO UNDO!

Example photo representation. (application/json)

{"message":"OK"}