Contents
- Redirect
- General Request Format
- Action: hello
- Action: latest
- Action: set
- Action: browse
- Action: search
Redirect
Because the photo archive is on a network without a fixed IP address, the photo app first has to find the current adress for the app server. It does this by going to a static URL (the redirect URL) which results in a plain-text document which has a single line with the URL of the photo app server.
General Request Format
The general request format used by the photo app is a JSON data stream containing at least the following basic parameters:
- app-name, which should be "photoApp".
- app-version with the application version number.
- app-build containing the application's build number.
- width with the device screen width.
- height with the device screen height.
- action with the action to take.
The response is again a JSON data stream containing at least the following elements:
- result, which is either "error" or "OK"
If the result is "error", the response will also contain an error object:
- error an object containing:
- code, a unique error code
- message, a descriptive error message
General error codes:
- 1001: no action was found in the request.
Action: hello
The first request that the app should send to the server. Through this request, the app anounces itself to the server.
Request parameters: only the standard request parameters.
Response parameters:
- app-url with the URL where subsequent requests should be sent (would normally be the same as the URL used for the hello request)
- image-url with a URL where to request image data.
- size: size to use for requesting image data (the size is determined based on the device capabilities)
Error returns:
- 2001: no width or height parameter in the request
- 2002: width or height has invalid value (nor numeric, or les than 100, or greater than 10,000)
Action: latest
Retrieve the latest (newest) set ID from the server.
Request parameters: the standard request parameters.
Response parameters:
- setid with the set ID of the latest set on the server
Action: set
Retrieve information about a specific set from the server
Request parameters:
- setid with the set ID that is requested.
Response parameters:
- setid with the set ID that is deliverd (this would be the same set ID that was requested)
- settitle: the title for the set
- setdescription: the description for the set
- setyear: the year for the set
- prevset: the ID for the previous set
- nextset: the ID for the next set
- imagelist is an array object with each array element
containing an object with the following information:
- imageid: the image ID of an image in the set.
- title: the title for the image.
- description: the description for the image.
Error responses
- 4001: no set ID in the request
- 4002: the specified set ID is not found in the archive
- 4003: no images found in the set
