I am new to Restful concept and have to design a simple API for a media analysis service I need to set up, to perform various tasks, e.g. face analysis, region detection, etc. on uploaded images and video.
Outline of my initial design is as follows:
- Client POSTs a configuration XML file to
http://manalysis.com/facerecognition
. This creates a profile that can be used for multiple analysis sessions. Response XML includes aProfileID
to refer to this profile. Clients can skip this step to use the default config parameters - Client POSTs video data to be analyzed to
http://manalysis.com/facerecognition
(with ProfileID as a parameter, if it's set up). This creates an analysis session. Return XML has theSessionID
. - Client can send a GET to
http://manalysis.com/facerecognition/SessionID
to receive the status of the session.
Am I on the right track? Specifically, I have the following questions:
- Should I include
facerecognition
in the URL? Roy Fielding says that "a REST API must not define fixed resource names or hierarchies" Is this an instance of that mistake? - The analysis results can either be returned to the client in one large XML file or when each event is detected. How should I tell the analysis engine where to return the results?
- Should I explicitly delete a profile when analysis is done, through a DELETE call?
Thanks,
C
You can fix the entry point url,
Create a new profile by posting the XML profile to the URL in the href attribute of the Profiles element
Initiate the analysis by creating a new Analysis Request. I would avoid using the term session as it is too generic and has lots of negative associations in the REST world.
Check the status of the process
when the processing has finished, the same GET could return
The specific URLs that I have chosen are relatively arbitrary, you can use whatever is the clearest to you.