Thanks for all the help! I finally able to get this to work using the basic auth method. Below is what I have
Original Message:
Sent: Wed April 03, 2024 08:58 PM
From: Yohji Amano
Subject: Call Rest API function script - authentication parameter help
Hi Ray
According to https://developer.bigfix.com/rest-api/examples/get-computer.html, it describes:
cURL
curl -X GET --user {username}:{password} https://{server}:{port}/api/computer/{id}
The above implies Basic Authentication is used because the curl default authentication is basic authentication.
So I think you can try with basic authentication code in your playbook.
------------------------------
Yohji Amano
------------------------------
Original Message:
Sent: Wed April 03, 2024 07:16 PM
From: Ray Tam
Subject: Call Rest API function script - authentication parameter help
Thanks for the suggestions but I don't have much luck to get it to work.
The BigFix API authentication is very strange. It is different from the one I work with before.
Below is the vendor URL with authentication example in Python. It didn't mention anything about the base64.
https://developer.bigfix.com/rest-api/examples/get-computer.html
import requests
r = requests.get('https://{server}:{port}/api/computer/{id}', auth=('{username}', '{password}'))
print(r.text)
------------------------------
Ray Tam
Original Message:
Sent: Wed April 03, 2024 12:03 PM
From: Luis Alejandro Moy Ruiz
Subject: Call Rest API function script - authentication parameter help
Hi, if you are using basic authentication or you have the token after authenticating you can send header, I put an example of a call that i made to Qradar that requires the token, In the call i put in the headers.
I don't know if you use basic authentication so you need to use this header instead of SEC than im using
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
The base64 is composed of
<user>:<passwd>.
in base64 coding
import json
api_access1 = workflow.properties.api_creds
qtoken = api_access1.token
qurl =
api_access1.qradar_url+"api/ariel/searches?query_expression="+api_access1.parsed
_query
rheaders = """
Accept: application/json
Accept-encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded
SEC: """+qtoken+"""
"""
inputs.rest_method = "POST"
inputs.rest_url = qurl
inputs.rest_headers = rheaders
inputs.rest_verify = False
inputs.rest_timeout = 300
Luis Alejandro Moy Ruiz CISSP,CISA
Mobile: +52 55 7865 9481
Customer Success Manager
