--- title: "Calculator via GET method and passing of parameters in the query part" slug: "tutorials-http-examples-calculator-get" updated: 2025-11-18T09:53:27Z published: 2025-12-04T02:44:08Z canonical: "docs.lobstersoftware.com/tutorials-http-examples-calculator-get" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Calculator via GET method and passing of parameters in the query part With an HTTP GET request, two integer values are transferred to a profile as so-called query parameters: | http:///dw/Request/profilSuffix?int_1=24&int_2=42 | | --- | **Note:** The query parameters are introduced by a question mark (?) in the URL. The query is composed of key and value pairs. The assignment of the values to the keys (also called parameters) is done by equal signs (=). The pairs are separated from each other by ampersands (&). You can access the individual query parameters in the mapping via the [system variable](/docs/en/intro-concepts-system-variables) *MSG_CALL_HEADER_HTTP_QUERY*. In addition, further information, such as the complete query part, is available to you as variables as well. ## Step 1 - Main settings Please create a new profile with a descriptive name, e.g. *Lobster_Tutorial_HTTP_simple_calculator*. ![images/download/attachments/137305183/simple_calculator_basis_1-version-1-modificationdate-1686289551475-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/simple_calculator_basis_1-version-1-modificationdate-1686289551475-api-v2.png) Select the mapping type *Data routing* or *No mapping*, as the GET method has no request body and thus the content of the input document is irrelevant. ## Step 2 - Phase 1 Select the event-based Input Agent of type *HTTP* in phase 1. ![images/download/attachments/137305183/simple_calculator_phase1_1-version-1-modificationdate-1686289551487-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/simple_calculator_phase1_1-version-1-modificationdate-1686289551487-api-v2.png) In order to send data to a profile via HTTP, you must address a specific URL. The schematic structure of the URL is *://:/* - Protocol: *http(s)* - Server and port: DNS name or IP address of the Integration Server and optionally the port. - URL context: For profiles with event-based Input Agent *dw/Request* or for time-driven profiles */dw/Trigger* - URL suffix: Name that describes the functionality of the profile. Select *simple_calculator* as the *URL address suffix* for this profile. This makes the profile accessible under *https:///dw/Request/simple_calculator* **Note:** A comprehensive explanation of all settings for the [Input Agent HTTP](/docs/en/profiles--entry-tab-2-webservice) can be found in the context help. Activate the *GET* checkbox as shown in the screenshot above. In order for the caller to receive a dynamic response, please set *'Custom class' or 'Pass back data' in response channel of profile* under *Send response* *by*. The *response on error* is not that important in an exercise and we recommend simply entering a meaningful error message that also clearly identifies the profile, e.g. *error@Lobster_Tutorial_HTTP_simple_calculator {--Exception--}*. ## Step 3 - Setting variables in phase 3 To be able to access the query parameters *int_1* and *int_2* in phase 3, you must declare the MSG_CALL variables in advance as follows: - *MSG_CALL_INT_1* - *MSG_CALL_INT_2* The corresponding MSG_CALL variables will be filled with the passed values when the profile is called, thus the values are available in the mapping. ## Step 4 - Creating target structure and calculation in phase 3 A source structure already exists if you have selected the option *Data routing* in the *Main settings*. This setting will create dummy data, because the input data has no relevance to you. Create a target structure node with the name *Result* and a field *result* below it. In the result field, we want to display the complete equation. If a user sends the HTTP request | http:///dw/Request/simple_calculator?int_1=24&int_2=42 | | --- | , the following text should be returned in the body of the HTTP response: *24 + 42 = 66* ![images/download/attachments/137305183/simple_calculator_phase3_2-version-1-modificationdate-1686289551500-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/simple_calculator_phase3_2-version-1-modificationdate-1686289551500-api-v2.png) ![images/download/attachments/137305183/simple_calculator_phase3_1-version-1-modificationdate-1686289551510-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/simple_calculator_phase3_1-version-1-modificationdate-1686289551510-api-v2.png) Define the following functions on the target structure field r*esult*: ```calculationfunctions result: 1. a + b  a variable: MSG_CALL_INT_1  b variable: MSG_CALL_INT_2 2. concat(a,b,c,d,e,f,g,h, [CR-support i])  a variable: MSG_CALL_INT_1  b value: " + "  c variable: MSG_CALL_INT_2  d value: " = "  e result: 1 (i.e. the calculation from the first function) ``` The first function is used to add the values, while the second function is used to generate the string. ## Step 5 - Phase 6 and output In the Input Agent in phase 1, the option *'Custom class' or 'Pass back data' in response channel of profile* was deliberately set to generate a dynamic response. Now, in phase 6, create a new Response of type "Custom class" with class "PassBackDataResponse" to receive a response from this profile. If this Response fails, the whole job is allowed to fail (option is activated by default in the Response). Select "FixRecord" as the content setting. In practice, this format provides output in which the implementer does not use fixed character lengths or generate specific separators. Please save the Response and the profile. ![images/download/attachments/137305183/simple_calculator_phase6-version-1-modificationdate-1686289551521-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/simple_calculator_phase6-version-1-modificationdate-1686289551521-api-v2.png) Enter the following address via your browser: http:///dw/Request/simple_calculator?int_1=24&int_2=42 ![images/download/thumbnails/137305183/image2022-5-17_12-33-51-version-1-modificationdate-1686289325553-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-5-17_12-33-51-version-1-modificationdate-1686289325553-api-v2.png)You'll find logs and meta data for the profile in the log overview of the Control Center.