Foundry Lab 02 - Hello Name Integration Service
Duration 15 Min
What you will learn
You'll learn how to create an integration with an input parameter, validate the input parameter and error or return a JSON object including a message element that says "Hello" to the username sent.
Prerequisites
- Lab 01 completed
Steps
helloName.vss
- For completeness, in
atlas.json
, add a second element to mainScripts called "helloName.vss". - Create a file "helloName.vss" in the src directory.
- Type "foundry" and accept the Foundry Boilerplate snippet.
-
Between the two comment blocks, enter the following code:
If (VoltMxRequest.getInputParam("username") = "") Then Call VoltMxResult.setErrorMessage("Please enter username") Else Call VoltMxResult.result.insertValue("message", "Hello " & VoltMxRequest.getInputParam("username")) End If
-
Save the file.
Package for Volt Foundry
- From the Command Palette, run "VoltScript: Package for Foundry".
- Enter the project directory, confirm atlas.json locations and continue with nothing entered for additional files to package.
Success
A file is created in the root of the project called "foundry-lab.1.0.0.zip". The zip name comprises the project name and the project version from the atlas.json.
Update Volt Foundry Integration Service
- Log into Volt Foundry.
- On the Apps page, select the app you created in Foundry Lab 01.
- On Configure Services tab, click the Integration tab.
- Click the Service Definition tab for the "foundry-lab-vs" integration service.
- Click Upload New and select the zip file you just created. You will receive a warning that this will update the endpoint operations. Click OK.
- Set the Name to "helloName".
- Click SAVE & ADD OPERATION.
- Select "helloName.vss" as the file.
-
Click ADD OPERATION.
-
Scroll down to the bottom of the operation and click SAVE AND FETCH RESPONSE.
-
On the Request Input tab of the operation, click + Add Parameter.
- Set the NAME to "username".
- Set the TEST VALUE to "John Doe".
-
Scroll down to the bottom of the operation and click SAVE AND FETCH RESPONSE.