Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ By default, the well-known endpoint (**Automatic configuration URL**) does not i
You can create your own APIs within your Mendix app and secure the end point over OIDC using a custom authentication microflow. To do this:

1. Create a REST API endpoint which needs to be secured.
2. Use **Custom** as the [authentication method](/refguide/published-rest-service/#authentication) to secure the endpoint with an access token.
2. Use **Custom** as the authentication method to secure the endpoint with an access token.
3. Select the `OIDC.APIAuthentication` microflow from the **OIDC.APIAuthentication** folder of the module which has `HTTPRequest` as the input and returns `System.User` as the output.

### Using `APIAuthentication` for Client Credentials Grant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Published REST services can be secured with basic authentication, active session

If you do not want basic authentication, there are three options:

* You can use [no authentication](/refguide/published-rest-service/#authentication) for specific published REST services.
* You can use no authentication for specific published REST services.
* When you [allow anonymous users](/refguide/app-security/#anonymous-users) to your app, published REST services become available without authentication. This only applies if the anonymous user has been selected for the allowed roles for the published service, and **Username and password** has been selected as the authentication method.
* You can implement [custom authentication using a microflow](/refguide/published-rest-service/#authentication-microflow).

{{% alert color="warning" %}}
Web service users cannot access REST services.
{{% /alert %}}

For more details, see [Published REST Routing](/refguide/published-rest-routing/) and the [Requires Authentication](/refguide/published-rest-service/#authentication) section in *Published REST Service*.
For more details, see [Published REST Routing](/refguide/published-rest-routing/).

## Documentation {#interactive-documentation}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ To save a service's [OpenAPI (Swagger) documentation](/refguide/open-api/) on yo

When the app is running, these files are available under */rest-doc/{location}/openapi.json* and */rest-doc/{location}/swagger.json*, where *{location}* is the location of the REST service (for instance, *rest/myservice/v1*).

## Security
## Enable CORS

### Requires Authentication {#authentication}
Check this box when your service needs to be available on websites other than your own.

Select if clients need to authenticate or not.
Click [Settings](/refguide/cors-settings/) to specify this access in more detail (for example, which websites are allowed to access the service).

## Security

### Authentication Methods

Expand All @@ -80,11 +82,11 @@ If authentication is required, you can select which authentication methods to su
xmlHttp.send(null);
```

* Select **Custom** to authenticate using a microflow. This microflow is called every time a user wants to access a resource.
* Select **Custom microflow** to authenticate using a microflow. This microflow is called every time a user wants to access a resource.

Check more than one authentication method to have the service try each of them. It will first try **Custom** authentication, then **Username and password**, and then **Active session**. For more details, see [Published REST Routing](/refguide/published-rest-routing/).

### Microflow {#authentication-microflow}
### Custom Microflow {#authentication-microflow}

Specify which microflow to use for custom authentication.

Expand All @@ -110,12 +112,6 @@ The allowed roles define which [module role](/refguide/module-security/#module-r
Web service users cannot access REST services.
{{% /alert %}}

## Enable CORS

Check this box when your service needs to be available on websites other than your own.

Click [Settings](/refguide/cors-settings/) to specify this access in more detail (for example, which websites are allowed to access the service).

## Resources

A REST service exposes a number of [resources](/refguide/published-rest-resource/). On a resource, you can define the following operations:
Expand All @@ -128,8 +124,6 @@ A REST service exposes a number of [resources](/refguide/published-rest-resource
* `HEAD`
* `OPTIONS`

You can drag an entity or a message definition onto this list to [generate a complete resource](/refguide/generate-rest-resource/).

## Operations

When you select a resource, you see the [operations](/refguide/published-rest-operation/) that are defined for that resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ To create the mapping, follow these steps:

1. In the **App Explorer**, right-click the **RESTExample** module and select **Add other** > **Published REST Service**.
2. Enter *PRS_OrderService* for the **Name** of your REST service. Then press **OK** to create and start editing the new REST service.
3. Add a new resource to your service by clicking **Add** in the **Resources** field. Enter **GetOrderByID** for the **Resource name**, then click **OK**.
3. Add a new resource to your service by clicking **Add resource**. Enter *GetOrderByID* for the **Resource name**.

{{< figure src="/attachments/refguide/modeling/integration/rest-services/publish-rest-service/AddRestResource.png" alt="Adding a GetOrderByID resource" class="no-border" >}}

4. Add an operation to your resource by clicking **Add** in the **Operations for resource** field.
5. In the **Operation** dialog box, enter `{OrderID}` in the **Operation path** field, making sure to include the braces (`{}`). This allows the REST service to be invoked with the order ID in the URL shown in the **Example location** field of the dialog box.
4. Add an operation to your resource by clicking **Add operation**.
5. Enter *{OrderID}* in the **Operation path** field, making sure to include the braces (`{}`). This allows the REST service to be invoked with the order ID in the URL shown in the **Example location** field of the dialog box.

{{< figure src="/attachments/refguide/modeling/integration/rest-services/publish-rest-service/AddOperation.png" alt="{OrderID} in the Operation path field" class="no-border" >}}

6. In the same dialog box, click **Select** next to the **Microflow** field. You do not yet have a microflow for this operation, so select the **RESTExample** module in the dialog box and click **New** to create a new microflow. Enter *PRS_GetGetOrderByID* for the **Name** of this new microflow, then click **OK**.
6. Click **Select** next to the **Microflow** field. You do not yet have a microflow for this operation, so select the **RESTExample** module in the dialog box and click **New** to create a new microflow. Enter *PRS_GetGetOrderByID* for the **Name** of this new microflow, then click **OK**.

7. In the **Parameters** field of the same **Operation** dialog box, click **Add** and add an **OrderID** path parameter.
7. In the **Parameters** list, click **Add** and add an **OrderID** path parameter.

{{< figure src="/attachments/refguide/modeling/integration/rest-services/publish-rest-service/OperationsDialogSettings.png" alt="Operation path, microflow, and parameter settings" class="no-border" >}}

8. <a id="edit-microflow"></a>Click **OK** to close out the **Operation** dialog box, then click **Show** to start editing the newly created microflow. Add a **OrderID** parameter.
8. <a id="edit-microflow"></a>**Show** to start editing the newly created microflow. Add a **OrderID** parameter.

{{% alert color="info" %}}This parameter might be added automatically, along with an **httpRequest** parameter. If an **httpRequest** parameter is added, remove it to avoid getting errors.<br/>
An **httpResponse** parameter may also be automatically added. If this happens and you follow the steps below in [Building an Export Mapping](#export-mapping), you must remove the parameter to avoid getting errors.{{% /alert %}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: "Configure a published REST Operation by adding parameters to an op

When a client calls a published REST operation, it calls a URL with an optional query string and possibly a body. These parameters can be passed to the microflow and import mapping as query parameters, path parameters, body parameters, header parameters, and form parameters.

When you add or edit a parameter in a published REST operation, you can specify the settings described below. These settings are in the **Add parameter** section of the **Add operation for resource** dialog box.
When you add or edit a parameter in a published REST operation, you can specify the settings described below.

## General

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ A published REST operation is part of a [published REST resource](/refguide/publ

In the **Published REST Service** document, you can add items to be included in the service as **Resources**:

{{< figure src="/attachments/refguide/modeling/integration/rest-services/published-rest-services/published-rest-service/published-rest-operation/publshed-rest-service.png" alt="Published REST Service" class="no-border" >}}
{{< figure src="/attachments/refguide/modeling/integration/rest-services/published-rest-services/published-rest-service/published-rest-operation/published-rest-service.png" alt="Published REST Service" class="no-border" >}}

## Operation Definition

When you **Add** or **Edit** a resource, you can define the resource in the **Operation** definition dialog box for the selected item as follows:
After you **Add** a resource, you can **Add** or **Edit** operations as follows:

{{< figure src="/attachments/refguide/modeling/integration/rest-services/published-rest-services/published-rest-service/published-rest-operation/operation-definition.png" alt="REST Operation" class="no-border" >}}

Expand Down Expand Up @@ -99,7 +99,7 @@ Check this box to mark the operation as deprecated in the service's OpenApi (Swa

#### Parameters

You can **Add**, **Update**, or **Delete** the parameters of the operation, which is described in [Operation Parameters for Published REST](/refguide/published-rest-operation-parameter/).
You can **Add**, **Edite**, **Delete** or **Move** the parameters of the operation, which is described in [Operation Parameters for Published REST](/refguide/published-rest-operation-parameter/).

##### Import Mapping {#import-mapping}

Expand All @@ -119,7 +119,7 @@ The import mapping is also used to generate object schemas for operation respons

#### Response

This defines the response of the operation. You can specify the type of the microflow result and the export mapping applied to it (if any).
This defines the response of the operation. You see the type of the microflow result and specify the export mapping applied to it (if any).

##### Type

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading