Skip to content

Commit 9277609

Browse files
authored
Merge pull request #11172 from mendix/qt-review
Review Consumed REST docs
2 parents 59b9f35 + 52cfe26 commit 9277609

2 files changed

Lines changed: 44 additions & 44 deletions

File tree

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
title: "Consumed REST Service"
33
url: /refguide/consumed-rest-services/
4-
description: "Presents an overview of consumed REST services and JSON in Mendix."
4+
description: "Describes how to interact with REST APIs in Mendix and build REST requests."
55
weight: 15
66
#If moving or renaming this doc file, implement a temporary redirect and let the respective team know they should update the URL in the product. See Mapping to Products for more details.
77
---
88

99
## Consumed REST Services
1010

11-
Mendix offers different features which allow you to interact with any REST API. You can use them to build and test your REST requests or create data structures in your project.
11+
Mendix offers features that allow you to interact with any REST API. You can use them to build and test your REST requests or create data structures in your project.
1212

1313
## Read More
1414

15-
* [Consumed REST Service](/refguide/consumed-rest-service/), an overview on how to Consume a REST Service document
16-
* [Import an OpenAPI/Swagger contract](/refguide/consumed-rest-service/#installation), instructions on how to create a Consumed REST Service from an OpenAPI/Swagger contract
17-
* [Call REST Service](/refguide/call-rest-action/), a description of the microflow action
18-
* [Use Call REST Service Action in a Microflow](/refguide/integration/use-call-rest-action-in-microflow/), instructions on how to use the Call REST Service action in a microflow
19-
* [HttpRequest and HttpResponse System Entities](/refguide/http-request-and-response-entities/), an overview of these system entities in your domain model
15+
* [Consumed REST Service](/refguide/consumed-rest-service/) – Describes how to consume a REST service
16+
* [Import an OpenAPI/Swagger contract](/refguide/consumed-rest-service/#installation) – Describes how to create a consumed REST service from an OpenAPI/Swagger contract
17+
* [Call REST Service](/refguide/call-rest-action/) – Describes the Call REST Service microflow action
18+
* [Use Call REST Service Action in a Microflow](/refguide/integration/use-call-rest-action-in-microflow/) – Describes how to use the Call REST Service action in a microflow
19+
* [HttpRequest and HttpResponse System Entities](/refguide/http-request-and-response-entities/) – Describes these system entities in your domain model

content/en/docs/refguide/modeling/integration/rest-services/consumed-rest-services/consumed-rest-service.md

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Consumed REST Service"
33
url: /refguide/consumed-rest-service/
4-
description: "Describes the configuration and usage of the new Consumed REST service document."
4+
description: "Describes how to configure and use the Consumed REST Service document."
55
weight: 5
66
aliases:
77
- /refguide/consumed-rest-services-beta/
@@ -10,17 +10,17 @@ aliases:
1010

1111
## Introduction
1212

13-
Use the Consumed REST Service document to send REST requests from Mendix Studio Pro. With this feature, you can build, test, and create data structures to store your requests.
13+
Use the Consumed REST Service document to send REST requests from Studio Pro. With this feature, you can build, test, and create data structures to store your requests.
1414

1515
{{% alert color="info" %}}
1616
The Consumed REST Service document is released for general availability (GA) for Windows only. This feature is still in beta for macOS and will be released for GA at a later date.
1717
{{% /alert %}}
1818

1919
### Use Cases
2020

21-
Use the Consumed REST Service document to do the following:
21+
You can use the Consumed REST Service document to do the following:
2222

23-
* Consume a REST Service manually or from an OpenAPI/Swagger contract
23+
* Consume a REST service manually or from an OpenAPI/Swagger contract
2424
* Configure `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` requests
2525
* Create entities directly in the domain model
2626
* Send REST requests through a microflow
@@ -31,18 +31,18 @@ The ability to import an OpenAPI/Swagger contract is currently in beta.
3131

3232
### Limitations
3333

34-
* To use the request response to create a data structure automatically in your domain model, the response data should be in JSON format. It is possible to process other formats, such as XML or raw text, but you will need to extract the data you are looking for in a microflow.
35-
* It is currently not possible to configure parameters in the Query Parameters tab.
36-
* Streaming responses from APIs are currently not supported.
37-
* A response can be mapped in a microflow only for responses with status code `200`. If a Send REST request action is executed in a microflow and the status code is in 2xx range, but different than `200`, use the latestHttpResponse to get the status code and response content.
34+
* To use the request response to create a data structure automatically in your domain model, the response data must be in JSON format. You can process other formats, such as XML or raw text, but you need to extract the data in a microflow.
35+
* You cannot configure parameters in the Query Parameters tab.
36+
* Streaming responses from APIs are not supported.
37+
* A response can be mapped in a microflow only for responses with status code `200`. If a Send REST request action is executed in a microflow and the status code is in the 2xx range but different than `200`, use the latestHttpResponse to get the status code and response content.
3838

3939
### Prerequisites
4040

4141
* Familiarity with [HTTP request methods](https://www.w3schools.com/tags/ref_httpmethods.asp)
4242

4343
## Add the Consumed REST Service Document {#installation}
4444

45-
Download [Studio Pro](https://marketplace.mendix.com/link/studiopro/) and add the Consumed REST Service document to your app. To do this, follow these steps:
45+
Download [Studio Pro](https://marketplace.mendix.com/link/studiopro/) and add the Consumed REST Service document to your app by doing the following:
4646

4747
1. Right-click the module you want to add the Consumed REST Service document to.
4848
2. Select **Add other** > **Consumed REST service**.
@@ -63,9 +63,9 @@ For more information about importing from an OpenAPI/Swagger contract, see the [
6363

6464
## Configuration {#configuration}
6565

66-
Use the Consumed REST Service to configure a `GET`, `POST`, `PUT`, `PATCH`, or `DELETE` request for your app. A request can be configured manually or by uploading an OpenAPI or Swagger contract.
66+
Use the Consumed REST Service to configure a `GET`, `POST`, `PUT`, `PATCH`, or `DELETE` request for your app. You can configure a request manually or by uploading an OpenAPI or Swagger contract.
6767

68-
If you upload an OpenAPI URL or Swagger contract, the content of the URL or file will be automatically added to your consumed REST service document. You can still manually configure the request after upload, such as add new [parameters](#add-parameters), [headers](#add-headers), or create entities from the request/response.
68+
If you upload an OpenAPI URL or Swagger contract, the content of the URL or file is automatically added to your consumed REST service document. You can still manually configure the request after upload, such as adding new [parameters](#add-parameters), [headers](#add-headers), or creating entities from the request/response.
6969

7070
### Basic Configuration {#configure-a-request}
7171

@@ -84,13 +84,13 @@ Create a `GET`, `POST`, `PUT`, `PATCH`, or `DELETE` request to send data to your
8484
To make the base URL dynamic, see the [Dynamic Base URL](#dynamic-base-url) section below.
8585

8686
5. Click **Authentication**.
87-
6. Select an authentication method, then click **OK**. For more information, see [Authentication methods](#authentication).
87+
6. Select an authentication method, then click **OK**. For more information, see [Authentication Methods](#authentication).
8888

8989
{{< figure src="/attachments/refguide/modeling/integration/rest-services/consumed-rest-service/configuration-screen.png" width="500" >}}
9090

9191
7. Click **Send**.
9292

93-
You can visualize your request in the **Response** tab, then use the response to [create an entity in the domain model](#create-entity).
93+
You can visualize your request in the **Response** tab and use the response to [create an entity in the domain model](#create-entity).
9494

9595
### Import from OpenAPI/Swagger Contract {#open-api-import}
9696

@@ -128,9 +128,9 @@ Parameters are not supported in the Authentication section.
128128

129129
{{% /alert %}}
130130

131-
Parameters are fully supported in the path and query part of the URL, in the header value, and in the body. They are defined within curly brackets. For example, in the URL, defining `number` as parameter would be `http://numbersapi.com/{number}`. The parameters that are configured for the URL, headers, or body within curly brackets are automatically added to the parameters grid.
131+
Parameters are fully supported in the path and query part of the URL, in the header value, and in the body. They are defined within curly brackets. For example, in the URL, defining `number` as a parameter would be `http://numbersapi.com/{number}`. The parameters that are configured for the URL, headers, or body within curly brackets are automatically added to the parameters grid.
132132

133-
You can manually add new parameters to the parameters grid directly. To do so, follow these steps:
133+
You can manually add new parameters to the parameters grid. To do so, follow these steps:
134134

135135
1. Open the **Parameters** tab and click **Add parameter**.
136136
2. Name your parameter and add a test value.
@@ -144,12 +144,12 @@ You can manually add new parameters to the parameters grid directly. To do so, f
144144
You can add a Base URL as a parameter. To do this, follow these steps:
145145

146146
1. Click **Base URL**.
147-
2. In the Dynamic field, select **Yes**.
148-
3. Click **OK**
147+
2. In the **Dynamic** field, select **Yes**.
148+
3. Click **OK**.
149149

150150
{{< figure src="/attachments/refguide/modeling/integration/rest-services/consumed-rest-service/dynamic-base-url.png" class="no-border" width="600" >}}
151151

152-
Your base URL is now considered as a parameter. You can change its value in the [Send REST Request](/refguide/send-rest-request/) microflow activity.
152+
Your base URL is now a parameter. You can change its value in the [Send REST Request](/refguide/send-rest-request/) microflow activity.
153153

154154
#### Adding Query Parameters
155155

@@ -165,7 +165,7 @@ Parameters are not supported in the Query Parameters table.
165165

166166
{{% /alert %}}
167167

168-
Query parameters can be configured in the **Parameters** tab in the **Query Parameters** table. You can define them directly in the URL or add them manually in the Query parameters field.
168+
Query parameters can be configured in the **Parameters** tab in the **Query Parameters** table. You can define them directly in the URL or add them manually in the **Query parameters** field.
169169

170170
##### Adding Query Parameter to URL
171171

@@ -177,17 +177,17 @@ To add multiple parameters, add an ampersand (&) between each parameter, joining
177177

178178
##### Manually Add Query Parameters
179179

180-
You can manually add new query parameters directly to the Query parameters grid. To do this, follow the steps below:
180+
You can manually add new query parameters directly to the **Query parameters** grid by doing the following:
181181

182182
1. Open the **Parameters** tab.
183183
2. Click **Add query parameter**.
184184
3. Name your query parameter and add a test value.
185185

186-
In this case, the newly configured query parameter will be automatically added to the URL.
186+
The newly configured query parameter is automatically added to the URL.
187187

188-
By default, when a new query parameter is added to the grid, it is configured as a **Required** query parameter. You can change this setting to **Not required** by clicking the drop-down and changing the value of the required property to **No**.
188+
By default, when you add a new query parameter to the grid, it is configured as **Required**. You can change this setting to **Not required** by clicking the drop-down and changing the value of the required property to **No**.
189189

190-
To include or exclude a query parameter from the URL, check or uncheck the checkbox of the specific query parameter.
190+
To include or exclude a query parameter from the URL, select or clear the checkbox for that query parameter.
191191

192192
### Adding Headers {#add-headers}
193193

@@ -205,9 +205,9 @@ You can also add a parameter as the test value of a header, as seen below. For e
205205

206206
{{< figure src="/attachments/refguide/modeling/integration/rest-services/consumed-rest-service/parameters-for-header.png" class="no-border" width="300" >}}
207207

208-
### Adding a Request Body (for POST, PUT, and PATCH requests only) {#add-a-request-body}
208+
### Adding a Request Body (for POST, PUT, and PATCH Requests Only) {#add-a-request-body}
209209

210-
`POST`, `PUT`, and `PATCH` requests support sending text as as a request body. Multiple formats are supported.
210+
`POST`, `PUT`, and `PATCH` requests support sending text as a request body. Multiple formats are supported.
211211

212212
#### Request Body That Sends Static Text
213213

@@ -217,17 +217,17 @@ If the request body content is static, paste the text into the **Body** tab. Thi
217217

218218
#### Adding a Request Body Using Parameters
219219

220-
When the text in the Body tab contains a parameter name surrounded by curly braces, it is interpreted as a parameter. These parameters can be used to change the body content dynamically.
220+
When the text in the **Body** tab contains a parameter name surrounded by curly braces, it is interpreted as a parameter. You can use these parameters to change the body content dynamically.
221221

222222
{{< figure src="/attachments/refguide/modeling/integration/rest-services/consumed-rest-service/body-structure-example.png" class="no-border" width="500" >}}
223223

224224
For example, if your body content is `product_curr={currency}&product_price={price}`, the parameters `currency` and `price` can be used to change the body content.
225225

226-
#### Request Body Where Content Comes From Multiple Entities
226+
#### Request Body Where Content Comes from Multiple Entities
227227

228-
When you have a body in JSON format, you can create entities in the domain model that will provide the body content. This allows you to easily send a body with dynamic data.
228+
When you have a body in JSON format, you can create entities in the domain model that provide the body content. This allows you to send a body with dynamic data.
229229

230-
Create body entities from a JSON snippet to your request by doing the following:
230+
To create body entities from a JSON snippet for your request, do the following:
231231

232232
1. Click the **Body** tab and add your JSON string.
233233

@@ -249,7 +249,7 @@ You can check the response of your request in the **Response data** tab.
249249

250250
#### Response is in JSON Format {#create-entity}
251251

252-
If the response is in JSON format and you want to use the response to create an entity, open the **Response structure** tab, which displays a preview of the response data:
252+
If the response is in JSON format and you want to use it to create an entity, open the **Response structure** tab, which displays a preview of the response data:
253253

254254
{{< figure src="/attachments/refguide/modeling/integration/rest-services/consumed-rest-service/response-structure-tab.png" class="no-border" width="500" >}}
255255

@@ -260,29 +260,29 @@ The entity name is prefilled, but you can change it to a custom name. To create
260260

261261
You can also add a parameter in the request body by generating a data structure (entities) as input. If only a small part of the request is dynamic, you can use parameters directly in the JSON snippet.
262262

263-
You can choose to flatten and simplify the structure of your response. Enable this feature by selecting **Flatten and simplify structure**. For more information, see the [Simplifying and Flattening Response Data](#simplify-and-flatten) section below.
263+
You can flatten and simplify the structure of your response by selecting **Flatten and simplify structure**. For more information, see [Simplifying and Flattening Response Data](#simplify-and-flatten).
264264

265265
#### Response is Not in JSON Format {#processing-non-json}
266266

267267
When the response is not in JSON format, it cannot be converted automatically into entities. Instead, you can extract the data in a microflow.
268268

269-
When the [Send REST request](/refguide/send-rest-request/) action is executed in a microflow, it places the result into the variable `latestHttpResponse`. In `latestHttpResponse`, you can find the `StatusCode` and `Content` of the request that was made. From here, you can use microflow logic to extract the information. For example, if the response has XML formatting, you can use [Import Mapping](/refguide/import-mappings/) to read the data.
269+
When the [Send REST request](/refguide/send-rest-request/) action is executed in a microflow, it places the result in the variable `latestHttpResponse`. In `latestHttpResponse`, you can find the `StatusCode` and `Content` of the request. You can then use microflow logic to extract the information. For example, if the response has XML formatting, you can use [Import Mapping](/refguide/import-mappings/) to read the data.
270270

271271
### Simplifying and Flattening Response Data {#simplify-and-flatten}
272272

273-
When you receive JSON data, the structure of the response is simplified and flattened where possible. This can be seen in the **Response structure** tab.
273+
When you receive JSON data, the structure of the response is simplified and flattened where possible. You can see this in the **Response structure** tab.
274274

275-
For example, the URL `https://vpic.nhtsa.dot.gov/api/vehicles/getallmakes?format=json` returns vehicle information. It returns a JSON object that contains the property `Results` with a list of objects. Without simplification, when you click **Create entity**, you will get 3 entities. With simplification, only 2 entities are created that still contain all vehicle information.
275+
For example, the URL `https://vpic.nhtsa.dot.gov/api/vehicles/getallmakes?format=json` returns vehicle information. It returns a JSON object that contains the property `Results` with a list of objects. Without simplification, when you click **Create entity**, you get three entities. With simplification, only two entities are created that still contain all vehicle information.
276276

277-
By default, simplification and flattening is enabled. To change this, uncheck the box **Flatten and simplify structure** on the **Response structure** tab before clicking the **Create entity** button.
277+
By default, simplification and flattening is enabled. To change this, clear **Flatten and simplify structure** on the **Response structure** tab before clicking **Create entity**.
278278

279279
### Using a REST Request in a Microflow {#add-entity-to-microflow}
280280

281-
To select a request in the microflow, complete the following steps:
281+
To select a request in a microflow, do the following:
282282

283283
1. Create a new microflow and drag the [Send REST request](/refguide/send-rest-request/) activity into it.
284284
2. Double-click the activity and click **Select** to choose the request you want to add, then click **Select** > **OK**.
285285

286286
{{< figure src="/attachments/refguide/modeling/integration/rest-services/consumed-rest-service/send-request-activity.png" class="no-border" width="500" >}}
287287

288-
If you have defined parameters in the request, they will be added to the activity. Click **Edit** to change the parameter in the microflow. The parameter values in this activity are used by the runtime instead of the test value defined in the request.
288+
If you have defined parameters in the request, they are added to the activity. Click **Edit** to change the parameter in the microflow. The parameter values in this activity are used by the runtime instead of the test value defined in the request.

0 commit comments

Comments
 (0)