I’ve gone through the documentation:
https://developer.bigfix.com/rest-api/api/baseline.html
It said:
… It is possible for you to synchronize all of a baseline’s components using the two step process described for the request GET /api/baseline/{site type}/{site name}/{id}/sync. …
You can use the above request to synchronize a baseline as follows:
Retrieve and store a baseline’s synchronized version using the above request.
Replace the baseline with its synchronized version using a PUT /api/baseline/{site type}/{site name}/{id} request.
Request: URL is all that is required
Response: BES XML baseline representation.
Response Schema: BES.xsd.
I’ve done that with Postman and all of the Fixlets change status to “source fixlet differs”
What I’m doing wrong?
I can’t really tell what’s happening in your animated gif, but are you doing both steps of the two-step process?
When you runs GET of the id/sync, it will return the XML of a “sync’d” version of the baseline.
Your tool needs to store that XML, and then PUT that over the existing baseline (or, if you like, POST it as a new baseline so you have both versions).
Hi @JasonWalker - I’ve uploaded the video to YouTube - https://youtu.be/JOC02XgB69E
Dunno what to say, I’m not familiar with Postman but watching your video I didn’t see anything obviously wrong, unless it’s a copy/paste from the wrong (unsynced) source baseline?
I put together a short Python code that is working on mine.
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# import warnings
verify = False
server = "https://my-server-url:52311"
username = "my-operator-name"
password = "my-operator-password"
baseline_url = "baseline/custom/test/5395"
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def restapi(
url,
operation,
data=None,
headers=None,
verify=None,
auth=None,
querystring=None,
files=None,
):
if auth == (None, None) or auth is None:
# print("restapi trying with authorization header or anonymous")
response = requests.request(
operation,
url,
data=data,
headers=headers,
verify=verify,
params=querystring,
files=files,
)
else:
# print("restapi: auth is " + str(auth))
response = requests.request(
operation,
url,
data=data,
headers=headers,
verify=verify,
auth=auth,
params=querystring,
files=files,
)
if not response.ok:
raise ValueError(
"Error encountered when sending "
+ operation
+ " to "
+ url
+ " [response was: HTTP "
+ str(response.status_code)
+ " "
+ response.reason
+ "]"
)
else:
return response
response = restapi(
url=server + "/api/" + baseline_url + "/sync",
operation="GET",
verify=False,
auth=(username, password),
)
synced_baseline = response.text
response = restapi(
url=server + "/api/" + baseline_url,
operation="PUT",
verify=False,
data=synced_baseline,
auth=(username, password),
)
print(response.text)
I should also say, my lab’s still not at 10.0.6 yet but I should have some time to upgrade it this weekend. It might be worth seeing if we have a new bug in that specific version?
I just upgraded my deployment to 10.0.6 and the Python code I posted earlier is still successfully synchronizing my test baseline. Have you found any issue on your end?
This py would be good to place in a new folder in https://github.com/bigfix/restapi-examples
1 Like
I just want to make an Update with POSTMAN - I just had to save the response as a file and then use it as a binary.