Samples > Starter stores > Starter store enhancements > Social Commerce > WebSphere Commerce Dojo Enhancements API > Social Commerce services > REST API
Photo galleries
The Social Commerce PhotoGallery widget uses the REST API to retrieve, create, and recommend content from photo galleries, photos, and comments posted for photos that is stored with the social content provider.
The PhotoGallery widget uses the following methods:
- GET
- Used to retrieve content from photo galleries, photos, and comments posted for photos.
- POST
- Used to create new photos and photo comments.
- PUT
- Used to recommend a photo or flag a photo as inappropriate.
- DELETE
- Used to delete a photo.
REST API for photo galleries
HTTP method URI Description Data type Query parameters Authenticated user GET /photoGalleries/<photoGalleryId> Retrieves a photo gallery with a page of photos. photoGallery
- pageSize
- onPage
POST /photoGalleries/<photoGalleryId>/photos Creates a new photo. photo ✓ GET /users/<userId>/photos Retrieves a page of photos created by a specified user. photoPage GET /photoGalleries/<photoGalleryId>/photos/<photoId> Retrieves a photo from a photo gallery. photo PUT /photoGalleries/<photoGalleryId>/photos/<photoId> Either recommends a photo from a photo gallery or reports a photo from a photo gallery as inappropriate. One of the following:
- recommendation
- reportInappropriate
✓ DELETE /photoGalleries/<photoGalleryId>/photos/<photoId> Deletes a photo from a photo gallery. Only valid for the user who created the photo. ✓ POST /photoGalleries/<photoGalleryId>/photos/<photoId>/photoComments Creates a new comment for a photo. photoComment ✓ GET /photoGalleries/<photoGalleryId>/photos/<photoId>/photoComments Retrieves a page of photo comments. photoCommentPage
- pageSize
- onPage
GET /photoGalleries/<photoGalleryId>/photos/<photoId>/photoComments/<photoCommentsId> Retrieves a single photo comment. photoComment
Data types
The following table lists the data types contained in the REST API for the PhotoGallery widget and provides a code snippet to illustrate each data type.
Data type Example photoGallery
{ "id":{ "type": "string" }, "title":{ "type": "string" }, "onPage":{ "type": "integer" }, "pageSize":{ "type": "integer" }, "numPhotos":{ "type": "integer" }, "photos":{ "type": "array", "arrayType": "photo" } }
photo
{ "id":{ "type": "string" }, "galleryHandle": { "type": "string" }, // Optional - usually only specified when fetching by username "title":{ "type": "string" }, "description":{ "type": "string" }, "date":{ "type": "date" }, "numComments":{ "type": "integer" }, "numRecommendations":{ "type": "integer" }, "authorId":{ "type": "string" }, "tags":{ "type": "array", "arrayType": "string" }, "thumb":{ "type": "string" }, "full":{ "type": "string" } }
photoPage
{ "onPage":{ "type": "integer" }, "pageSize":{ "type": "integer" }, "numEntries":{ "type": "integer" }, "photos":{ "type": "array", "arrayType": "photos" } }
recommendation
{ "recommend": { "type": "boolean" }, "action":"recommend" }
reportInappropriate
{ "inappropriate": { "type": "boolean" }, "action":"reportInappropriate" }
photoComment
{ "id":{ "type": "string" }, "authorId":{ "type": "string" }, "datePosted": { "type": "string" }, "body":{ "type": "string" } }
photoCommentPage
{ "photoGalleryId":{ "type": "string" }, "photoId":{ "type": "string" }, "pageSize":{ "type": "integer" }, "onPage":{ "type": "integer" }, "numComments":{ "type": "integer" }, "comments":{ "type": "array", "arrayType": "comment" } }
Query parameters
The following table lists and describes each of the query parameters contained in the REST API for the PhotoGallery widget.
Name Type Range Description pageSize integer [1,infinity) The number of photos or comments to return. onPage integer [1,infinity) The starting page index of photos or comments to return. For example, when the pageSize is set to 10 and the onPage value is set to 3, the request returns photo entries 30 through 39.
Related reference
Search engine optimized (SEO) content