> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/other-help-articles/javascript-webservice-call.md).

# JavaScript Webservice Call

## Description

The Webservice part ([https://community.logicnets.com/t/g9hxjsz/call-webservice](/release-9/platform-documentation/process-node-parts/call-a-generic-webservice.md)) allows you to perform a web service call and retrieve a response on the server side. However, there are cases in which you would want to perform a web service call on the client side instead. You can do that using JavaScript to send a client-side request to the Webservice framework and get a response back.

This topic walks you through the process of taking the attached example project and modifying it to work with your webservice project and send a client-side request. When you run the example from the logicnet, the system will ask a few questions that are generic and can be easily changed to fit your webservice. Download the example project and import it into your Designer.

## Example

Node 30 of the example is a project node with a ‘set\_data\_object’ part. This part sets the full URL of the endpoint of your webservice call: *///*. This variable is used throughout the example.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-37ccde40d4083266b73c0e7281fc5d6f1f2c7662%2F72c654b6-87ed-4e8c-a43a-6a284ee14b63.png?alt=media)

Node 20 of the example is a process node that contains an ‘authentication.external\_users’ part that is used for authentication to the server. The target is your */*. The system uses the result, called ‘webservice\_bearer’ in this instance, in the JavaScript ajax call to the webservice.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-c89110e22de6e0d0fabe9627f68aeb5f388370ad%2F07207940-00d0-4b83-8f95-f4cd511ca825.png?alt=media)

Node 120 contains a ‘redirect’ part used to send all data and parameters via JavaScript to the webservice project. You can add as many parameters as you want.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-eb918d4199b98af48d4eed37ef102919da26e3b7%2Fbc9c3cde-de02-4a28-a154-10d93b5ac07e.png?alt=media)

Node 130 contains the call to the JavaScript script that is included in the example project. As parameters, you enter the data from the redirect part and the authentication.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-63c5b8aeb951bfcb3339ec4e3e46b3b44decdd14%2Fe665d4cb-d094-476a-aee5-f33e6f2039d8.png?alt=media)

When you test the logicnet or project and click ***Next***, the system triggers the JavaScript call. When you click ***Next*** again, the system returns the result and displays it in Node 110.

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-b56cd2097bed6c5cc780a6f2429e3462a7aec304%2Fd144b5e4-7c84-4dd6-b9ac-4b7dcce6a33d.png?alt=media)

## Update Settings

To make sure that the endpoints in the Webservice project can receive the request from the JavaScript client you need to update a few of the settings, as noted below.

### Update Security White List

1. On your LogicNets dashboard, navigate to *System Configuration*.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-d576f692b73601baffb4148451b541bd5226f7b5%2F3276e2a1-5854-4bb8-8d67-2532b86555ae.png?alt=media)
2. From the *Security* tab, add the text below to the *Content Security Policy* setting, making sure you change ‘<https://your-site-name’> to the base URL where your webservice is hosted.

   default-src 'self'; script-src 'self' [www.gstatic.com](http://www.gstatic.com) [www.google.com](http://www.google.com) [www.googletagmanager.com](http://www.googletagmanager.com) [www.google-analytics.com](http://www.google-analytics.com) [www.googleadservices.com](http://www.googleadservices.com) <http://localhost:41666> 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' [www.google.com](http://www.google.com) 'unsafe-inline' [www.google-analytics.com](http://www.google-analytics.com) <https://googleads.g.doubleclick.net> data:; connect-src 'self' [www.google-analytics.com](http://www.google-analytics.com) [www.googletagmanager.com](http://www.googletagmanager.com) <http://localhost:41666> <https://your-site-name>; frame-src 'self' [www.google.com](http://www.google.com);

![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-f9eed452867f9dd953c241d2c33b645870fec3af%2F831199da-50af-4679-80ce-009b7f46cb20.png?alt=media)

### Update Authorization Token

1. On your LogicNets dashboard, navigate to *Access Management.*

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-870ecc12d97f9db25b5e7449b6f6b33530e6141f%2F91c6c59f-ae11-41e8-b0ae-afbd187aa6bb.png?alt=media)
2. Go to the *Users* tab and click ***new***.
3. From the *Type* dropdown menu, select ***server*** to create a new server user.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-be52e8138d51ac3c844e2d9a8a0fea5860bed019%2F17ee7a12-a37b-42e0-ac38-c5f563aad6ba.png?alt=media)
4. Go to the *Groups* tab and create a new group.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-47fde7941628ed899b2f000045a8a79721dfd20f%2F361a3cc9-ae8c-4304-b018-bb6a7cd15902.png?alt=media)
5. Add your newly created user to the group.
6. Go back to the user you created and click ***modify***.
7. Select ***RS256 signed JWT Web*** token from the *Authentication Method* dropdown menu and click ***Generate new RSA key pair***.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-1e37d1efe42681d9cf0dd29bc23bf180b5fd886c%2Fff432805-56b2-47cb-a77c-4bf5a45e6969.png?alt=media)
8. Save the private key. You will need this for the client.

### Update the JavaScript Client Server

1. On the LogicNets dashboard, navigate to *Access Management*.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-1a5361c02770c8b269d4c6c5dc3801c2aad6d072%2F08c0508e-7295-439c-8939-a6eaf6bdaf90.png?alt=media)
2. Go to the *Server connections* tab and click ***new***.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-fdb2c843a58575717e1c3e85b2d7e143aac9160f%2Fc9445ea4-16d4-4eb5-b6d2-f0dfdff8e99e.png?alt=media)
3. Select ***Add account manually*** from the *Type* dropdown menu.

   ![](https://2802811211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdFhfexCjZ5JMhwGzzywq%2Fuploads%2Fgit-blob-00e438763a5778be3ba7e90ad8956547759dd135%2F62c8e9cb-d7e0-4c78-a460-3bd962260c8e.png?alt=media)
4. In the *External instance URL* field, enter \[*/*]
5. In the *User name* field, copy the username that you just create on the server.
6. Select ***RS256*** from the *Password type* dropdown menu.
7. Copy your private key into the *Private RSA Key* field.
8. Select ***Send feedback*** from the *Purpose* dropdown menu.

## Attachments

* [Example\_JavaScript\_webcall.zip](https://github.com/logicnets/community-portal/tree/release-9/docs/.gitbook/assets/802lbd-Example_JavaScript_webcall.zip)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/other-help-articles/javascript-webservice-call.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
