且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设计一个媒体分析引擎一个RESTful API

更新时间:2023-11-30 12:54:46

您可以修复入口点URL,

You can fix the entry point url,

GET /facerecognition

<FaceRecognitionService>
  <Profiles href="/facerecognition/profiles"/>
  <AnalysisRequests href="/facerecognition/analysisrequests"/>
</FaceRecognitionService>

张贴的XML配置文件的URL在情景元素的href属性创建一个新的配置文件

Create a new profile by posting the XML profile to the URL in the href attribute of the Profiles element

POST /facerecognition/profiles
201 - Created
Location: /facerecognition/profile/33

通过创建一个新的分析请求启动的分析。我会避免使用术语会话实在是太通用的,有很多负面的联想,在世界其它地区。

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.

POST /facerecognition/analysisrequests?profileId=33
201 - Created
Location: /facerecognition/analysisrequest/2103

检查进程的状态

GET /facerecognition/analysisrequest/2103

<AnalysisRequest>
   <Status>Processing</Status>
   <Cancel Method="DELETE" href="/facerecognition/analysisrequest/2103" />
</AnalysisRequest>

在加工完成后,同一GET可以返回

when the processing has finished, the same GET could return

<AnalysisRequest>
   <Status>Completed</Status>
   <Results href="/facerecognition/analysisrequest/2103/results" />
</AnalysisRequest>

这是我所选择的具体网址是比较乱,您可以使用什么是最清楚的给你。

The specific URLs that I have chosen are relatively arbitrary, you can use whatever is the clearest to you.