kaldesai commented on code in PR #541:
URL: 
https://github.com/apache/incubator-kie-kogito-docs/pull/541#discussion_r1496888784


##########
serverlessworkflow/modules/ROOT/pages/core/custom-functions-support.adoc:
##########
@@ -531,7 +531,91 @@ kogito.sw.functions.greet.timeout=5000 <1>
 ----
 <1> Time in milliseconds
 
-== Custom function types
+== Rest Custom Function 
+
+Serverless Workflow Specification defines the 
xref:service-orchestration/orchestration-of-openapi-based-services.adoc[OpenAPI 
function type], which is the preferred way to interact with existing REST 
servers. 
+However, sometimes a workflow shoud interact with several REST APIs which are 
not described using an OpenAPI specification file. Since generating such file 
for these services might be a tedious exercise, {product_name} offers REST 
custom type as a shorcut. 
+
+When using custom rest, in the function definition you specify the HTTP URI to 
be invoked and the HTTP method (get, post, patch or put) to be used, using 
`operation` string. When the function is actually invoked you pass the request 
arguments as you do when using an OpenAPI function. 
+
+The following example shows the declaration of a `rest` function:
+
+.Example of a `rest` function declaration
+[source,json]
+----
+{
+  "functions": [
+    {
+      "name": "multiplyAllByAndSum", <1>
+      "type": "custom", <2>
+      "operation": "rest:post:/numbers/{multiplier}/multiplyByAndSum" <3>
+    }
+  ]
+}
+----
+
+<1> `multiplyAllAndSum` is the function name
+<2> `custom` is the function type
+<3> `rest:post:/numbers/{multiplier}/multiplyByAndSum` is the custom operation 
definition. In the custom operation definition: 
+* `rest` is the reserved operation keyword that indicates this is a REST call.
+* `post` is the HTTP method. 
+* `/numbers/{multiplier}/multiplyByAndSum` is the relative endpoint. 
+
+When using relative endpoints you must specify the host as a property. The 
format of the host property is `kogito.sw.functions.<function_name>.host`. 
Therefore, in this example, the host property key  is 
`kogito.sw.functions.multiplyAllByAndSum.host`. You might override the default 
port (80) if needed by specifying `kogito.sw.functions.multiplyAllAndSum.port` 
property. 

Review Comment:
   ```suggestion
   When using the relative endpoints you must specify the host as a property. 
The format of the host property is `kogito.sw.functions.<function_name>.host`. 
Therefore, in this example, `kogito.sw.functions.multiplyAllByAndSum.host` is 
the host property key. You might override the default port (80) if needed by 
specifying `kogito.sw.functions.multiplyAllAndSum.port` property. 
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to