Wiki source code of HTTP Operations
Last modified by Martijn Woudstra on 2022/08/11 11:00
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
46.1 | 1 | {{container}}{{container layoutStyle="columns"}}((( |
| 2 | |||
| 3 | In this microlearning, we will focus on learning about HTTP Operations. | ||
| 4 | A crucial part of setting up your (API) Gateway with the help of RESTful services is | ||
| 5 | knowing what HTTP Operations are and how you can use them to control what parties can change via your (API) Gateway. | ||
| 6 | |||
| 7 | Should you have any questions, please contact [[academy@emagiz.com>>mailto:academy@emagiz.com]]. | ||
| 8 | |||
| 9 | == 1. Prerequisites == | ||
| 10 | |||
| 11 | * Basic knowledge of the eMagiz platform | ||
| 12 | |||
| 13 | == 2. Key concepts == | ||
| 14 | |||
| 15 | This microlearning centers around HTTP Operations in conjunction with the API Gateway solution of eMagiz. | ||
| 16 | With HTTP Operations we mean: Identify the action (i.e. Create, Read, Update or Delete) that needs to be performed on a resource (i.e. Client, Order, Employee) | ||
| 17 | With API Gateway we mean: A collection of RESTful API operations that can be published to the outside world to give them access to applications that are linked to your business process | ||
| 18 | |||
| 19 | Each HTTP Method represents a certain action on a resource. Of the most frequently used ones we can make a nice comparison to the CRUD operations: | ||
| 20 | |||
| 21 | HTTP Operations: CRUD Operations: | ||
| 22 | |||
| 23 | * POST - Create | ||
| 24 | * GET - Read | ||
| 25 | * PUT - Update | ||
| 26 | * DELETE - Delete | ||
| 27 | |||
| 28 | So the POST represents a Create action, the GET a read action, etc. | ||
| 29 | |||
| 30 | This also means that when you do a GET (a read action) it should **not** alter the resource you are requesting from your backend operation if you want to adhere to the RESTful principles. | ||
| 31 | |||
| 32 | == 3. HTTP Operations == | ||
| 33 | |||
| 34 | A crucial part of setting up your (API) Gateway with the help of RESTful services is | ||
| 35 | knowing what HTTP Operations are and how you can use them to control what parties can change via your (API) Gateway. | ||
| 36 | |||
| 37 | Each HTTP Method represents a certain action on a resource. Of the most frequently used ones we can make a nice comparison to the CRUD operations: | ||
| 38 | |||
| 39 | HTTP Operations: CRUD Operations: | ||
| 40 | |||
| 41 | * POST - Create | ||
| 42 | * GET - Read | ||
| 43 | * PUT - Update | ||
| 44 | * DELETE - Delete | ||
| 45 | |||
| 46 | So the POST represents a Create action, the GET a read action, etc. | ||
| 47 | |||
| 48 | This also means that when you do a GET (a read action) it should **not** alter the resource you are requesting from your backend operation if you want to adhere to the RESTful principles. | ||
| 49 | |||
| 50 | === 3.1 Determining the HTTP Operations in eMagiz === | ||
| 51 | |||
| 52 | When you look at the conceptual idea of the API Gateway, exposing backend operations via a centralized location to the outside world | ||
| 53 | it stands to reason that when you set up your API Gateway (i.e. the front-end facing part) start with the backend operation you want to expose. | ||
| 54 | |||
| 55 | When the backend operation also adheres to the RESTful principles you can simply reuse that HTTP method. | ||
| 56 | For example, if they have a GET operation to an HTTP Operation that you want to expose you should also have a GET operation on the API Gateway side. | ||
| 57 | |||
| 58 | To expose a backend operation directly in the API Gateway double click on the backend system and look for the available Endpoint operations | ||
| 59 | |||
| 60 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--endpoint-operations.png]] | ||
| 61 | |||
| 62 | Select one of them and press the button Expose in Gateway. This will lead you to the following pop-up. | ||
| 63 | In this pop-up select, the message type (the resource) that you want to link this operation to and press expose. | ||
| 64 | |||
| 65 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--endpoint-operations-message-type.png]] | ||
| 66 | |||
| 67 | The result is that you will see the following pop-up (which is also the main configuration and edit screen in case you want to alter something). | ||
| 68 | |||
| 69 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--api-gateway-exposed-from-backend-edit.png]] | ||
| 70 | |||
| 71 | The moment you are content with this action press Save and let eMagiz configure the exposed operation correctly. | ||
| 72 | |||
| 73 | === 3.2 Editing the HTTP Operation in eMagiz === | ||
| 74 | |||
| 75 | You can easily do so in eMagiz by editing the API Gateway integration in Design via the context menu or by double-clicking on it. | ||
| 76 | |||
| 77 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--edit-api-integration.png]] | ||
| 78 | |||
| 79 | In this pop-up, you can select the (backend) System Operation you want to expose via the API Gateway. | ||
| 80 | |||
| 81 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--edit-api-integration-pop-up.png]] | ||
| 82 | |||
| 83 | By pressing the button Select System Operation you will see an overview of all available operations | ||
| 84 | |||
| 85 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--edit-api-integration-pop-up-available-operations.png]] | ||
| 86 | |||
| 87 | Select the GET operation and eMagiz will update your integration. The result of this example will be that external clients can execute a | ||
| 88 | GET call to retrieve HTTP methods from the system called Crash Course * API Gateway via the help of the eMagiz API Gateway. | ||
| 89 | |||
| 90 | [[image:Main.Images.Microlearning.WebHome@crashcourse-api-gateway-api-http-operations--edit-api-integration-pop-up-result.png]] | ||
| 91 | |||
| 92 | In this screen, there are also other things you could edit that will come in handy in other scenarios. | ||
| 93 | |||
| 94 | For example, in case the external party does not adhere to the RESTful principle or does not even publish a REST endpoint but a SOAP endpoint or | ||
| 95 | something else entirely you need to remember the basic principles when determining the correct HTTP Operation for the job. | ||
| 96 | |||
| 97 | For example, when you need to call a backend operation that hosts a SOAP web service from which you can retrieve data (but not create or update it) you should use the GET operation **without** a body. | ||
| 98 | |||
| 99 | In future microlearnings, we will discuss these scenarios in more detail. | ||
| 100 | |||
| 101 | == 4. Assignment == | ||
| 102 | |||
| 103 | Configure a basic GET operation in the eMagiz API Gateway. | ||
| 104 | This assignment can be completed with the help of an associated Mendix project linked to the (Academy) project that you have created/used in the previous assignment. | ||
| 105 | |||
| 106 | == 5. Key takeaways == | ||
| 107 | |||
| 108 | Each HTTP Method represents a certain action on a resource. Of the most frequently used ones we can make a nice comparison to the CRUD operations: | ||
| 109 | |||
| 110 | HTTP Operations: CRUD Operations: | ||
| 111 | |||
| 112 | * POST - Create | ||
| 113 | * GET - Read | ||
| 114 | * PUT - Update | ||
| 115 | * DELETE - Delete | ||
| 116 | |||
| 117 | In eMagiz, you start your thought process at the backend operation and from there you set up your API Gateway. | ||
| 118 | |||
| 119 | == 6. Suggested Additional Readings == | ||
| 120 | |||
| 121 | If you are interested in this topic and want more information on it please read the help text provided by eMagiz and read the following links: | ||
| 122 | |||
| 123 | * https://www.restapitutorial.com/lessons/httpOperations.html#:~:text=The%20primary%20or%20most%2Dcommonly,but%20are%20utilized%20less%20frequently. | ||
| 124 | * https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html | ||
| 125 | |||
| 126 | == 7. Silent demonstration video == | ||
| 127 | |||
| 128 | This video demonstrates how you could have handled the assignment and gives you some context on what you have just learned. Disclaimer, you only see the eMagiz part but if you follow the above steps you are good to go! | ||
| 129 | |||
| 130 | {{video attachment="crashcourse-api-gateway-http-operations.mp4" reference="Main.Videos.Microlearning.WebHome"/}} | ||
| 131 | |||
| 132 | )))((({{toc/}}))){{/container}}{{/container}} |