# SimpleRESTHost - Hello World!

**URL:** https://community.linx.software/community/t/simpleresthost-hello-world/493
**Category:** Tutorial
**Created:** [December 17, 2020, 8:48am UTC](https://community.linx.software/community/t/simpleresthost-hello-world/493 "2020-12-17T08:48:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ronan](https://community.linx.software/community/user_avatar/community.linx.software/ronan/32/433_2.png) [@ronan](https://community.linx.software/community/u/ronan)
#### Post date: [December 17, 2020, 8:48am UTC](https://community.linx.software/community/t/simpleresthost-hello-world/493/1 "2020-12-17T08:48:58Z")

</div>

# Introduction

The [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) allows for the creation of REST operations through a configuration “wizard”, this means that you do not need to create an Open API definition like with the [RESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/resthost) .

The below describes how to create a “Hello World!” REST API using a[SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) .

 **Note:**  
  
 The [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) has limited functionality compared to the [RESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/resthost) . Operations can only have a `200 (OK)` response, if an error occurs then a `500 (Internal Server Error)` will be returned. In order to return custom response codes then you must make use of the [RESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/resthost) , more details can be found [**here**.](https://community.linx.software/community/t/resthost-guide-overview/458) 
  

 **Sample:**  
  
 The below sample Solution has been provided to aid understanding.

> [SimpleRESTHost\_HelloWorld.lsoz](https://community.linx.software/community/uploads/short-url/rPmG08fUgYEssDuQlzGKd5OiK19.lsoz) (5.4 KB)

# Hello World

The web service will contain a single operation with the `OperationID` of **HelloWorld** which will be executed by a request to the path `/helloworld`.

The **HelloWorld operation** is configured to have a `(200) OK` response code and the `response body` will be a [StringTYP](https://linx.software/docs/reference/plugins/linx/content/string) .

The web service will be tested locally using [**service debugging**](https://linx.software/docs/reference/designer/debugtool/#how-to-debug).

## Add a [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) to the Solution

To add a [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) to your Solution, drag the [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) from the **Plugins** panel (from the [RESTPLG](https://linx.software/docs/reference/plugins/rest/overview)section), into the **Solution Explorer**.

This will create a instance of a REST web service for you to build with.

Next, configure the **Properties** of the [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) like described in the following sections.

## Add operations

To create your operation’s definition, expand the Operations editor of the [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) .

You are then able to define the following using the editor:

- Name
- Path
- Method
- Header parameters
- Query string parameters
- Request body
- Response body

For the purpose of this tutorial we will be defining a single operation like below:

 ![image](https://community.linx.software/community/uploads/default/original/1X/a3f85d44dcf1824bae3e5bfe74af94f549816fca.png)

## Add operation logic

To add logic to the operation, click on the **HelloWorld** operation in the **Solution Explorer** , this will select the operation in the **Design Canvas**.

1. Add a [StringTYP](https://linx.software/docs/reference/plugins/linx/content/string) to the beginning of the operation by dragging it from the **Plugins Panel** onto the **Design Canvas** - this creates an instance of a [StringTYP](https://linx.software/docs/reference/plugins/linx/content/string) with the default `Name` of `String`.

2. Alter the initial Value of `String` to contain the text “Hello”.

3. Next, add another [StringTYP](https://linx.software/docs/reference/plugins/linx/content/string) to the operation , with the default Name of `String1`.

4. Alter the Value of `String1` to the text “World”.

5. Add a [SetValueFNC](https://linx.software/docs/reference/plugins/linx/content/setvalue) to the end of the operation, this is used to set the `response body` of the operation.

6. Reference `$.Result.Data.ResponseBody` as the Target of the [SetValueFNC](https://linx.software/docs/reference/plugins/linx/content/setvalue)

7. In order to create such an expression, open up the [expression editor](https://linx.software/docs/reference/designer/expressioneditor/) (EX) in the Source of the [SetValueFNC](https://linx.software/docs/reference/plugins/linx/content/setvalue) .

* * *

**Linx Designer view:**  
 ![SimpleRESTHost - Add Operations and logic](https://community.linx.software/community/uploads/default/original/1X/9c92ce681706ae5e76c911f2b4b5bfacb59b1453.gif)

* * *

### Debug service

In order to test the **service** out, you are able to **debug** the [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) . This will create a local instance of the **service** within the **Linx Designer** which you can then test calls on with your browser or [Postman](https://www.postman.com/). This allows you to both test the configuration of your web service as well as debug the logic within them with real time data.

1. In order for **service debugging** to work on your local machine, configure the Base URI of the [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) to:

2. Next, right-click on the [SimpleRESTHostSVC](https://linx.software/docs/reference/plugins/rest/content/simpleresthost) in the **Solution Explorer** and click **Debug**.

3. Next, click **Start** in the top menu bar.

4. To initiate the request flow, navigate to the below URL in a browser:

The request should succeed and a `(200) OK` response is returned with the `response body` content of “Hello World!” displayed in the browser window.

```http
Hello World!

```

* * *

**Linx Designer view:**  
 ![SimpleRESTHost - Debug Service](https://community.linx.software/community/uploads/default/original/1X/4798d6027e9d83e67e770c797b5c60ddca00bae4.gif)

**Congratulations!**

You’ve created your first web service with Linx.
