1、 ETSI GS MEC 009 V1.1.1 (2017-07) Mobile Edge Computing (MEC); General principles for Mobile Edge Service APIs Disclaimer The present document has been produced and approved by the Mobile Edge Computing (MEC) ETSI Industry Specification Group (ISG) and represents the views of those members who parti
2、cipated in this ISG. It does not necessarily represent the views of the entire ETSI membership. GROUP SPECIFICATION ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 2 Reference DGS/MEC-0009ApiPrinciples Keywords API, MEC ETSI 650 Route des Lucioles F-06921 Sophia Antipolis Cedex - FRANCE Tel.: +33 4 92 94 42 0
3、0 Fax: +33 4 93 65 47 16 Siret N 348 623 562 00017 - NAF 742 C Association but non lucratif enregistre la Sous-Prfecture de Grasse (06) N 7803/88 Important notice The present document can be downloaded from: http:/www.etsi.org/standards-search The present document may be made available in electronic
4、 versions and/or in print. The content of any electronic and/or print versions of the present document shall not be modified without the prior written authorization of ETSI. In case of any existing or perceived difference in contents between such versions and/or in print, the only prevailing documen
5、t is the print of the Portable Document Format (PDF) version kept on a specific network drive within ETSI Secretariat. Users of the present document should be aware that the document may be subject to revision or change of status. Information on the current status of this and other ETSI documents is
6、 available at https:/portal.etsi.org/TB/ETSIDeliverableStatus.aspx If you find errors in the present document, please send your comment to one of the following services: https:/portal.etsi.org/People/CommiteeSupportStaff.aspx Copyright Notification No part may be reproduced or utilized in any form o
7、r by any means, electronic or mechanical, including photocopying and microfilm except as authorized by written permission of ETSI. The content of the PDF version shall not be modified without the written authorization of ETSI. The copyright and the foregoing restriction extend to reproduction in all
8、 media. ETSI 2017. All rights reserved. DECTTM, PLUGTESTSTM, UMTSTMand the ETSI logo are Trade Marks of ETSI registered for the benefit of its Members. 3GPPTM and LTE are Trade Marks of ETSI registered for the benefit of its Members and of the 3GPP Organizational Partners. oneM2M logo is protected f
9、or the benefit of its Members GSM and the GSM logo are Trade Marks registered and owned by the GSM Association. ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 3 Contents Intellectual Property Rights 6g3Foreword . 6g3Modal verbs terminology 6g31 Scope 7g32 References 7g32.1 Normative references . 7g32.2 Infor
10、mative references 8g33 Definitions and abbreviations . 9g33.1 Definitions 9g33.2 Abbreviations . 9g34 Design principles for developing RESTful mobile edge service APIs 10g34.1 REST implementation levels 10g34.2 General principles. 10g34.3 Entry point of a RESTful mobile edge service API . 10g34.4 AP
11、I security and privacy considerations 11g35 Documenting RESTful mobile edge service APIs . 11g35.1 RESTful mobile edge service API template . 11g35.2 Conventions for names . 11g35.2.1 Case conventions 11g35.2.2 Conventions for URI parts 12g35.2.2.1 Introduction . 12g35.2.2.2 Path segment naming conv
12、entions 12g35.2.2.3 Query naming conventions . 13g35.2.3 Conventions for names in data structures . 13g35.3 Provision of an OpenAPI definition . 13g36 Patterns of RESTful mobile edge service APIs 13g36.1 Introduction . 13.g36.2 Pattern: Name syntax 14g36.2.1 Description 14g36.2.2 Names in payload bo
13、dies 14g36.2.3 Names in URIs 14g36.3 Pattern: Resource identification . 14g36.3.1 Description 14g36.3.2 Resource definition(s) and HTTP methods . 14g36.4 Pattern: Resource representations and content format negotiation . 15g36.4.1 Description 15g36.4.2 Resource definition(s) and HTTP methods . 15g36
14、.4.3 Resource representation(s) 15g36.4.4 HTTP headers . 15g36.4.5 Response codes and error handling . 16g36.5 Pattern: Resource creation 16g36.5.1 Description 16g36.5.2 Resource definition(s) and HTTP methods . 16g36.5.3 Resource representation(s) 17g36.5.4 HTTP headers . 17g36.5.5 Response codes a
15、nd error handling . 17g36.6 Pattern: Reading a resource 17g36.6.1 Description 17g36.6.2 Resource definition(s) and HTTP methods . 17g36.6.3 Resource representation(s) 17g36.6.4 HTTP headers . 17g36.6.5 Response codes and error handling . 17g36.7 Pattern: Queries on a resource 18g3ETSI ETSI GS MEC 00
16、9 V1.1.1 (2017-07) 4 6.7.1 Description 18g36.7.2 Resource definition(s) and HTTP methods . 18g36.7.3 Resource representation(s) 18g36.7.4 HTTP headers . 18g36.7.5 Response codes and error handling . 18g36.8 Pattern: Updating a resource (PUT) . 19g36.8.1 Description 19g36.8.2 Resource definition(s) a
17、nd HTTP methods . 20g36.8.3 Resource representation(s) 20g36.8.4 HTTP headers . 20g36.8.5 Response codes and error handling . 20g36.9 Pattern: Updating a resource (PATCH) 21g36.9.1 Description 21g36.9.2 Resource definition(s) and HTTP methods . 22g36.9.3 Resource representation(s) 22g36.9.4 HTTP hea
18、ders . 22g36.9.5 Response codes and error handling . 22g36.10 Pattern: Deleting a resource 23g36.10.1 Description 23g36.10.2 Resource definition(s) and HTTP methods . 23g36.10.3 Resource representation(s) 23g36.10.4 HTTP headers . 23g36.10.5 Response codes and error handling . 24g36.11 Pattern: Task
19、 resources . 24g36.11.1 Description 24g36.11.2 Resource definition(s) and HTTP methods . 24g36.11.3 Resource representation(s) 24g36.11.4 HTTP headers . 24g36.11.5 Response codes and error handling . 25g36.12 Pattern: REST-based subscribe/notify 25g36.12.1 Description 25g36.12.2 Resource definition(
20、s) and HTTP methods . 27g36.12.3 Resource representation(s) 27g36.12.4 HTTP headers . 27g36.12.5 Response codes and error handling . 27g36.13 Pattern: Asynchronous operations 28g36.13.1 Description 28g36.13.2 Resource definition(s) and HTTP methods . 29g36.13.3 Resource representation(s) 29g36.13.4
21、HTTP headers . 30g36.13.5 Response codes and error handling . 30g36.14 Pattern: Links (HATEOAS) . 30g36.14.1 Description 30g36.14.2 Resource definition(s) and HTTP methods . 30g36.14.3 Resource representation(s) 30g36.14.4 HTTP headers . 31g36.14.5 Response codes and error handling . 32g36.15 Patter
22、n: Error responses 32g36.15.1 Description 32g36.15.2 Resource definition(s) and HTTP methods . 32g36.15.3 Resource representation(s) 32g36.15.4 HTTP headers . 33g36.15.5 Response codes and error handling . 33g36.16 Pattern: Authorization of access to a RESTful mobile edge service API using OAuth 2.0
23、 33g36.16.1 Description 33g36.16.2 Resource definition(s) and HTTP methods . 36g36.16.3 Resource representation(s) 36g36.16.4 HTTP headers . 36g36.16.5 Response codes and error handling . 37g36.16.6 Discovery of the parameters needed for exchanges with the token endpoint . 37g36.16.7 Scope values .
24、37g3ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 5 7 Alternative transport mechanisms 37g37.1 Description . 37g37.2 Relationship of topics, subscriptions and access rights 38g37.3 Serializers . 40g37.4 Authorization of access to a service over alternative transports using TLS credentials . 40g3Annex A (inf
25、ormative): REST methods 43g3Annex B (informative): API response status and exception codes . 44g3Annex C (informative): Richardson maturity model of REST APIs . 45g3Annex D (informative): RESTful mobile edge service API template . 46g3History 55g3ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 6 Intellectual
26、Property Rights IPRs essential or potentially essential to the present document may have been declared to ETSI. The information pertaining to these essential IPRs, if any, is publicly available for ETSI members and non-members, and can be found in ETSI SR 000 314: “Intellectual Property Rights (IPRs
27、); Essential, or potentially Essential, IPRs notified to ETSI in respect of ETSI standards“, which is available from the ETSI Secretariat. Latest updates are available on the ETSI Web server (https:/ipr.etsi.org/). Pursuant to the ETSI IPR Policy, no investigation, including IPR searches, has been c
28、arried out by ETSI. No guarantee can be given as to the existence of other IPRs not referenced in ETSI SR 000 314 (or the updates on the ETSI Web server) which are, or may be, or may become, essential to the present document. Foreword This Group Specification (GS) has been produced by ETSI Industry
29、Specification Group (ISG) Mobile Edge Computing (MEC). Modal verbs terminology In the present document “shall“, “shall not“, “should“, “should not“, “may“, “need not“, “will“, “will not“, “can“ and “cannot“ are to be interpreted as described in clause 3.2 of the ETSI Drafting Rules (Verbal forms for
30、 the expression of provisions). “must“ and “must not“ are NOT allowed in ETSI deliverables except when used in direct citation. ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 7 1 Scope The present document defines design principles for RESTful mobile edge service APIs, provides guidelines and templates for t
31、he documentation of these, and defines patterns of how mobile edge service APIs use RESTful principles. 2 References 2.1 Normative references References are either specific (identified by date of publication and/or edition number or version number) or non-specific. For specific references, only the
32、cited version applies. For non-specific references, the latest version of the referenced document (including any amendments) applies. Referenced documents which are not found to be publicly available in the expected location might be found at https:/docbox.etsi.org/Reference. NOTE: While any hyperli
33、nks included in this clause were valid at the time of publication, ETSI cannot guarantee their long term validity. The following referenced documents are necessary for the application of the present document. 1 IETF RFC 7231: “Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content“. NOTE: Ava
34、ilable at https:/tools.ietf.org/html/rfc7231. 2 IETF RFC 7232: “Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests“. NOTE: Available at https:/tools.ietf.org/html/rfc72312. 3 IETF RFC 5789: “PATCH Method for HTTP“. NOTE: Available at https:/tools.ietf.org/html/rfc5789. 4 IETF RFC 6901: “Ja
35、vaScript Object Notation (JSON) Pointer“. NOTE: Available at https:/tools.ietf.org/html/rfc6901. 5 IETF RFC 7396: “JSON Merge Patch“. NOTE: Available at https:/tools.ietf.org/html/rfc7396. 6 IETF RFC 6902: “JavaScript Object Notation (JSON) Patch“. NOTE: Available at https:/tools.ietf.org/html/rfc69
36、02. 7 IETF RFC 5261: “An Extensible Markup Language (XML) Patch Operations Framework Utilizing XML Path Language (XPath) Selectors“. NOTE: Available at https:/tools.ietf.org/html/rfc5261. 8 IETF RFC 6585: “Additional HTTP Status Codes“. NOTE: Available at https:/tools.ietf.org/html/rfc6585. 9 IETF R
37、FC 3986: “Uniform Resource Identifier (URI): Generic Syntax“. NOTE: Available at https:/tools.ietf.org/html/rfc63986. 10 IETF RFC 7159: “The JavaScript Object Notation (JSON) Data Interchange Format“. NOTE: Available at https:/tools.ietf.org/html/rfc7159. ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 8 11 W
38、3C Recommendation 16 August 2006: “Extensible Markup Language (XML) 1.1“ (Second Edition). NOTE: Available at https:/www.w3.org/TR/2006/REC-xml11-20060816/. 12 IETF RFC 5988: “Web Linking“. NOTE: Available at https:/tools.ietf.org/html/rfc5988. 13 IETF RFC 2818: “HTTP Over TLS“. NOTE: Available at h
39、ttps:/tools.ietf.org/html/rfc2818. 14 IETF RFC 5246: “The Transport Layer Security (TLS) Protocol Version 1.2“. NOTE: Available at https:/tools.ietf.org/html/rfc5246. 15 IETF RFC 7807: “Problem Details for HTTP APIs“. NOTE: Available at https:/tools.ietf.org/html/rfc7807. 16 IETF RFC 6749: “The OAut
40、h 2.0 Authorization Framework“. NOTE: Available at https:/tools.ietf.org/html/rfc6749. 17 IETF RFC 6750: “The OAuth 2.0 Authorization Framework: Bearer Token Usage“. NOTE: Available at https:/tools.ietf.org/html/rfc6750. 2.2 Informative references References are either specific (identified by date o
41、f publication and/or edition number or version number) or non-specific. For specific references, only the cited version applies. For non-specific references, the latest version of the referenced document (including any amendments) applies. NOTE: While any hyperlinks included in this clause were vali
42、d at the time of publication, ETSI cannot guarantee their long term validity. The following referenced documents are not necessary for the application of the present document but they assist the user with regard to a particular subject area. i.1 ETSI GS MEC 001: “Mobile Edge Computing (MEC); Termino
43、logy“. i.2 “Please. Dont Patch Like An Idiot“, William Durand. NOTE: Available at http:/williamdurand.fr/2014/02/14/please-do-not-patch-like-an-idiot/. Accessed 17 May 2016. i.3 “Richardson Maturity Model: steps toward the glory of REST“, Martin Fowler, accessed 8 September 2016. NOTE: Available at
44、http:/ i.4 JSON Schema, Draft Specification v4, January 31, 2013. NOTE: Available at http:/json-schema.org/documentation.html. Also available as Internet Draft (work in progress) from https:/tools.ietf.org/html/draft-zyp-json-schema-04. i.5 W3C Recommendation: “XML Schema Part 0: Primer Second Editi
45、on.“. NOTE: Available at https:/www.w3.org/TR/xmlschema-0/. i.6 ETSI GS MEC 011: “Mobile Edge Computing (MEC); Mobile Edge Platform Application Enablement“. i.7 ETSI GS MEC 012: “Mobile Edge Computing (MEC); Radio Network Information API“. ETSI ETSI GS MEC 009 V1.1.1 (2017-07) 9 i.8 Hypertext Transf
46、er Protocol (HTTP) Status Code Registry at IANA. NOTE: Available at http:/www.iana.org/assignments/http-status-codes. i.9 MQTT Version 3.1.1, OASIS Standard, 29 October 2014. NOTE: Available at http:/docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html. i.10 Apache Kafka, https:/kafka.apache.
47、org/. i.11 GRPC, http:/www.grpc.io/. i.12 Protocol buffers, https:/ i.13 IETF RFC 7519: “JSON Web Token (JWT)“. NOTE: Available at https:/tools.ietf.org/html/rfc7519. i.14 OpenAPI Specification. NOTE 1: Available at https:/ NOTE 2: OpenAPI specification version 2.0 is recommended as it is the offici
48、al release at the time of publication. 3 Definitions and abbreviations 3.1 Definitions For the purposes of the present document, the terms and definitions given in ETSI GS MEC 001 i.1 and the following apply: resource: object with a type, associated data, a set of methods that operate on it, and, if
49、 applicable, relationships to other resources NOTE: A resource is a fundamental concept in a RESTful API. Resources are acted upon by the RESTful API using the Methods (e.g. POST, GET, PUT, DELETE, etc.). Operations on Resources affect the state of the corresponding managed entities. 3.2 Abbreviations For the purposes of the present document, the abbr