|
| 1 | +# Copyright 2016 Google Inc. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# |
| 16 | +# Example HTTP rules for Bookstore |
| 17 | +# |
| 18 | + |
| 19 | +# The configuration schema is defined by service.proto file |
| 20 | +# https://github.com/googleapis/googleapis/blob/master/google/api/service.proto |
| 21 | +type: google.api.Service |
| 22 | +config_version: 3 |
| 23 | + |
| 24 | +# |
| 25 | +# HTTP rules define translation from HTTP/REST/JSON to gRPC. With these rules |
| 26 | +# HTTP/REST/JSON clients will be able to call the Bookstore service. |
| 27 | +# |
| 28 | +http: |
| 29 | + rules: |
| 30 | + # |
| 31 | + # HTTP/REST/JSON clients can call the 'ListShelves' method of the Bookstore |
| 32 | + # service using the GET HTTP verb and the '/shelves' URL path. The response |
| 33 | + # will the JSON representation of the 'ListShelvesResponse' message. |
| 34 | + # |
| 35 | + # Client example (Assuming your service is hosted at the given 'DOMAIN_NAME'): |
| 36 | + # curl http://DOMAIN_NAME/v1/shelves |
| 37 | + # |
| 38 | + - selector: endpoints.examples.bookstore.Bookstore.ListShelves |
| 39 | + get: /v1/shelves |
| 40 | + # |
| 41 | + # 'CreateShelf' can be called using the POST HTTP verb and the '/shelves' URL |
| 42 | + # path. The posted HTTP body is the JSON respresentation of the 'shelf' field |
| 43 | + # of 'CreateShelfRequest' protobuf message. |
| 44 | + # |
| 45 | + # Client example: |
| 46 | + # curl -d '{"theme":"Music"}' http://DOMAIN_NAME/v1/shelves |
| 47 | + # |
| 48 | + - selector: endpoints.examples.bookstore.Bookstore.CreateShelf |
| 49 | + post: /v1/shelves |
| 50 | + body: shelf |
| 51 | + # |
| 52 | + # 'GetShelf' is available via the GET HTTP verb and '/shelves/{shelf}' URL |
| 53 | + # path, where {shelf} is the value of the 'shelf' field of 'GetShelfRequest' |
| 54 | + # protobuf message. |
| 55 | + # |
| 56 | + # Client example - returns the first shelf: |
| 57 | + # curl http://DOMAIN_NAME/v1/shelves/1 |
| 58 | + # |
| 59 | + - selector: endpoints.examples.bookstore.Bookstore.GetShelf |
| 60 | + get: /v1/shelves/{shelf} |
| 61 | + # |
| 62 | + # 'DeleteShelf' can be called using the DELETE HTTP verb and |
| 63 | + # '/shelves/{shelf}' URL path, where {shelf} is the value of the 'shelf' field |
| 64 | + # of 'DeleteShelfRequest' protobuf message. |
| 65 | + # |
| 66 | + # Client example - deletes the second shelf: |
| 67 | + # curl -X DELETE http://DOMAIN_NAME/v1/shelves/2 |
| 68 | + # |
| 69 | + - selector: endpoints.examples.bookstore.Bookstore.DeleteShelf |
| 70 | + delete: /v1/shelves/{shelf} |
| 71 | + # |
| 72 | + # 'ListBooks' can be called using the GET HTTP verb and |
| 73 | + # '/shelves/{shelf}/books' URL path, where {shelf} is the value of the 'shelf' |
| 74 | + # field of 'ListBooksRequest' protobuf message. |
| 75 | + # |
| 76 | + # Client example - list the books from the first shelf: |
| 77 | + # curl http://DOMAIN_NAME/v1/shelves/1/books |
| 78 | + # |
| 79 | + - selector: endpoints.examples.bookstore.Bookstore.ListBooks |
| 80 | + get: /v1/shelves/{shelf}/books |
| 81 | + # |
| 82 | + # 'CreateBook' can be called using the POST HTTP verb and |
| 83 | + # '/shelves/{shelf}/books' URL path, where {shelf} is the value of the 'shelf' |
| 84 | + # field of 'CreateBookRequest' protobuf message and the posted HTTP body is |
| 85 | + # the JSON representation of the 'book' field of 'CreateBookRequest' message. |
| 86 | + # |
| 87 | + # Client example - create a new book in the first shelf: |
| 88 | + # curl -d '{"author":"foo","title":"bar"}' http://DOMAIN_NAME/v1/shelves/1/books |
| 89 | + # |
| 90 | + - selector: endpoints.examples.bookstore.Bookstore.CreateBook |
| 91 | + post: /v1/shelves/{shelf}/books |
| 92 | + body: book |
| 93 | + # |
| 94 | + # 'GetBook' can be called using the GET HTTP verb and |
| 95 | + # '/shelves/{shelf}/books/{book}' URL path, where {shelf} is the value of the |
| 96 | + # 'shelf' field of 'GetShelfRequest' protobuf message and {book} is the value |
| 97 | + # of the 'book' field of the 'GetShelfRequest' message. |
| 98 | + # |
| 99 | + # Client example - get the first book from the second shelf: |
| 100 | + # curl http://DOMAIN_NAME/v1/shelves/2/books/1 |
| 101 | + # |
| 102 | + - selector: endpoints.examples.bookstore.Bookstore.GetBook |
| 103 | + get: /v1/shelves/{shelf}/books/{book} |
| 104 | + # |
| 105 | + # 'DeleteBook' can be called using DELETE HTTP verb and |
| 106 | + # '/shelves/{shelf}/books/{book}' URL path, where {shelf} is the value of the |
| 107 | + # 'shelf' field of 'DeleteShelfRequest' protobuf message and {book} is the |
| 108 | + # value of the 'book' field of the 'DeleteShelfRequest' message. |
| 109 | + # |
| 110 | + # Client example - delete the first book from the first shelf: |
| 111 | + # curl -X DELETE http://DOMAIN_NAME/v1/shelves/1/books/1 |
| 112 | + # |
| 113 | + - selector: endpoints.examples.bookstore.Bookstore.DeleteBook |
| 114 | + delete: /v1/shelves/{shelf}/books/{book} |
0 commit comments