Aras Labs Blog
2 MIN READ
Calling Methods via Configurable Web Services
christopher_gillis
7 months agoNew Member
In previous blog posts, we’ve covered how to set up a Configurable Web Service (CWS) within Aras Innovator®. In this post, we will cover a way to extend the functionality of a CWS endpoint by calling a server method.
To start, we will need to create the server Method that will be called via our CWS endpoint. In this example, we will be creating a new endpoint for registering Alternate parts. If a user passes in a Part Number for a part, and a Part Number for an alternate part, this method will create a Part Alternate relationship between the two.
gist.github.com/christophersgillis/f25bfd73feb7148715a44d72ac01e880
Note that at the start of this method we are retrieving two properties: the base_part_number and an alternate_part_number. When we make our web service below, we will configure the method endpoint to accept these two parameters.
Now that we have our Method defined, we can configure our CWS service such that we can call this Method from it.
With Postman open, we can set up the sample call we will be using to test our new Method endpoint. If you’ve been following along, your request should look something like the screenshot below. Note that because this is a Method endpoint, the request type should always be POST.
After configuring the Authorization for the request (either using an API Key or authenticating via OAuth), we should be able to click send and see that our Part Alternate was successfully added!
This is just one example of the ways that we can leverage server methods to make our CWS endpoints even more valuable. Let us know if there are any business needs that this functionality would be useful to address. We hope you will be joining us at this year’s ACE Tech Summit March 31, 2025 from 9:00 AM – 4:30, followed by a reception. Details and registration information may be found here.
Creating our Method
To start, we will need to create the server Method that will be called via our CWS endpoint. In this example, we will be creating a new endpoint for registering Alternate parts. If a user passes in a Part Number for a part, and a Part Number for an alternate part, this method will create a Part Alternate relationship between the two.
- Log in as an admin
- Navigate to TOC -> Administration -> Methods
- Create a new method with the method code below
gist.github.com/christophersgillis/f25bfd73feb7148715a44d72ac01e880
- Save and close the Method
Note that at the start of this method we are retrieving two properties: the base_part_number and an alternate_part_number. When we make our web service below, we will configure the method endpoint to accept these two parameters.
Defining our CWS Web Service
Now that we have our Method defined, we can configure our CWS service such that we can call this Method from it.
- Log in as an admin
- Navigate to TOC -> Administration -> External Access -> Web Services
- Create a new CWS web service
- Title: Parts Management
- Endpoint Name: PartsManagement
- Click save and now configure a new endpoint related to this web service
- Instead of clicking Add ItemTypes as you might have done following our previous blogs, click Add Global Methods
- Search for and select the method we created above
- The Alias here will determine what the actual URL will be, so set the Alias to AddPartAlternate
- We’ll also add two parameters to match what the method is expecting: the base_part_number and alternate_part_number
- Save both the endpoint and the web service and open Postman for testing
Calling our Method
With Postman open, we can set up the sample call we will be using to test our new Method endpoint. If you’ve been following along, your request should look something like the screenshot below. Note that because this is a Method endpoint, the request type should always be POST.
After configuring the Authorization for the request (either using an API Key or authenticating via OAuth), we should be able to click send and see that our Part Alternate was successfully added!
This is just one example of the ways that we can leverage server methods to make our CWS endpoints even more valuable. Let us know if there are any business needs that this functionality would be useful to address. We hope you will be joining us at this year’s ACE Tech Summit March 31, 2025 from 9:00 AM – 4:30, followed by a reception. Details and registration information may be found here.
Published 7 months ago
Version 1.0
christopher_gillis
New Member
Joined August 02, 2018
Aras Labs Blog
Tips, technical guides, and community news for developers and low-code builders