REST API examples

Here are some RESTAPI examples:

Generate a template task with prefetch from URL - Windows

Generate uninstall tasks for all MSI applications on target computer - Windows

Generate Dell BIOS Update Task from Dell Command Update Results - Windows

Note: Tasks to install, check for updates, and install updates using Dell Command Update are available on BigFix.me, as well as an analysis to audit the results.


All 3 of these examples have some similarities:

  • They send the console operator password to the endpoint using a secure parameter to use the REST API on the remote endpoint. (requires a v9+ client/server)
  • They use CURL to interact with the IEM / BigFix REST API through the command line.
  • They operate against the site from which they are “Taken Action” from.
  • They download the names of all existing Fixlets/Tasks from the current site to prevent creating duplicate tasks.
  • They use Relevance substitution as the main source of intelligence to generate the contents of a Task.bes file only the fly. In the case of the uninstall MSI task, multiple tasks are created at once.
  • They use javascript running in the console context to query info needed dynamically, like the root server URL&Port, the current site, the current site type, the current console operator user name, and if the user has write privileges (which might need some tweaking)

Examples for the REST API itself are on github. https://github.com/bigfix/restapi-examples

Do you have any RESTAPI examples you can share?

6 Likes

Thanks, JG. I was looking for something like this, This should Help!

1 Like

The Generate a template task with prefetch from URL - Windows one is a work in progress, so it is getting many changes over time.

Also, these examples are an idea of how to get around some of the limitations of Relevance / ActionScript.

In some cases it is hard to have ActionScript that is dynamic enough to accomplish a particular task, but you could have a task that runs on an endpoint and dynamically creates an action that would run on that same endpoint with actionscript that was dynamically generated by the original task.

Hi,
could you please explain how to generate task like this?
“task that runs on an endpoint and dynamically creates an action that would run on that same endpoint with actionscript that was dynamically generated by the original task”

What are you trying to create with the REST API?

I have many REST API examples on BigFix.Me which you can download, import into your console. You then run them on an endpoint it uses the REST API to dynamically create many Tasks.

I’ve made this a wiki post, so people can update jgstew’s original post with new REST API examples as they come in. That we won’t have to scroll through the entire thread looking for updates.

1 Like

hi,
I want to load dynamically list to TASK in bigfix and create an action from it. so that the TASK will updated when I change the list.
is it possible?

thanks,
Ortal

That should be possible, but if you are using an action to create the task, you would need the action to run periodically and only make the task if something has changed.

Is the list hosted on a webserver?

I really need a lot more information about your actual use case. Generally anything is possible, but I don’t really understand your goals to really point you in the right direction.

OK.
i’ll explain.

the list can be hosted on a webserver, but the problem is that it will cause overload on the share, because all of the computers will access this list.

the other option is to update every time the task, with the new list, but we want to do it automatically , is it possible?

thanks,
Ortal

How big is the list?
How many clients?
What are you trying to achieve with the list?


You could have an task that runs periodically, downloads the list once, makes another task that has a proper prefetch statement for the current list. You then run that resulting task on as many endpoints as you want and it will use the relay infrastructure to download the list.

If the list is small enough and in plain text, then the task that runs periodically could take the contents of the list and place it within a createfile command in a new task and use that to run against the endpoints. In that case no downloads would happen at all. This is the best option if the list contents are small.

Hi ortal,

It depends what you want to do with the list, and what the list contains.

For example, I’ve done something similar with a .csv extract from a database which contains environment information. The .csv file gets updated every day and the BigFix component is all automated - a policy action runs daily to update the hash value of the new file, and distributed using site propagation to all endpoints that need the file.

I then have another policy action that updates the endpoint properties with the latest information from the file.

@jgstew

I want to find the warranty date of my Dell laptop and few other laptops within my organisation.
Here is the Dell API query, when i put it on the browser. I get the .xml with my laptop’s warranty details.

https://api.dell.com/support/v2/assetinfo/warranty/tags.xml?svctags=xxxxxx&apikey=xxxxxxxxxxxx

My plan is to, create a relevance property to read the XML values and display them in the console.
But how do i achieve it? I believe you should have some idea on this.

where am stuck:

  1. I see the xml results in webpage, but how do i download it as a xml file and store it in a location.
  2. how do i get the xml file for other laptops?

Please share your thoughts!!!

See here:

1 Like

you already did it, Thank you!!!

1 Like

Hi All,

Is it possible to disable the TLS 1.2 in the REST API or to the specific user using the REST API ?
IEM server version : 9.2.8

I think that is possible in 9.5.11: BigFix 9.5 Patch 11 is now available