Try the following (it uses a different x-force call but illustrates how to encode the auth header)
Original Message:
Sent: Thu November 02, 2023 08:45 AM
From: Nabil Nehme
Subject: Getting info from exchange.xforce.ibmcloud.com
Hello Calvin
Thank you for your help
I have downloaded and installed the updated version.
I am using a URL that requires basic authentication
api_key = 'aaaaaaaaa'
api_password = 'bbbbbbbbb'
Please can you help me include the authentication credentials in the function?
Best
Nabil
------------------------------
Nabil Nehme
Original Message:
Sent: Thu November 02, 2023 06:43 AM
From: Calvin Wynne
Subject: Getting info from exchange.xforce.ibmcloud.com
Hi Nabil,
I see that you are still using Utilities: Call REST API to make REST requests. This application is outdated and is limited in features. Instead, I would like to recommend REST API Functions for SOAR which is an updated, standalone app with more features. I would also suggest you to take a look at the Call REST API example playbook (as shown below) to see all the various features and functionalities of this application.
![](https://dw1.s81c.com//IMWUC/MessageImages/0876141795c64a3c843c56bcff227f90.png)
As for your question, you could do one of the following:
- Write out the results to incident note or artifact description as shown below (script can be found in the Call REST API playbook):
![](https://dw1.s81c.com//IMWUC/MessageImages/52a5a5be58604c498d62a3b547cab0ca.png)
- Add information as hits to a given artifact (provided the object type you are working on is an artifact):
![](https://dw1.s81c.com//IMWUC/MessageImages/07b805db68304b7ba40b9e8f2e4b57d9.png)
You can modify the sample playbook to add hits by providing it in this format. Things to keep in mind while adding hits:
1. Supported data-types: number, uri, string
2. Hits must be a list of dictionaries.
3. Each dictionary must have a name, type and value.
4. Name would be your json key, and value would be json value.
5. List doesnot support advance dataypes, all values must be string or number, no nested dict or list.
I hope this information helps you.
------------------------------
Calvin Wynne
Original Message:
Sent: Wed November 01, 2023 09:42 AM
From: Nabil Nehme
Subject: Getting info from exchange.xforce.ibmcloud.com
Dears,
I am trying to use the "Utilities: Call REST API" function in order to get JSON info provided by the following IBM url https://exchange.xforce.ibmcloud.com/ip/185.99.32.36
I have tried a function's script as below but I am not able to get info as listed when I browse this URL:
import base64
import json
inputs.rest_verify = "True"
inputs.rest_method = "GET"
api_key = 'aaaaaaaaa'
api_password = 'bbbbbbbbb'
# Create a dictionary for the headers
headers = {
'Authorization': 'Basic ' + base64.b64encode(f'{api_key}:{api_password}'.encode('utf-8')).decode('utf-8')
}
# Convert the headers dictionary to a JSON object
headers_json = json.dumps(headers)
# Set the headers in the inputs
inputs.rest_headers = headers_json
base_url = 'https://exchange.xforce.ibmcloud.com/ip/' + artifact.value
inputs.rest_url = base_url
Any hints how to get these info into SOAR results?
Best Regards
Nabil
------------------------------
Nabil Nehme
------------------------------