Start a new topic
Implemented

Asset Management V2 APIs

We are introducing APIs (V2) for all Asset Management operations including entities such as Products and Locations. Here's the full list of APIs planned.


  • Products (Create, Update, View, List, Delete)
  • Locations (Create, Update, View, List, Delete)
  • Vendors (Create, Update, View, List, Delete)
  • Asset Types (Create, Update, List, Delete)
  • Asset Type Fields (View)
  • Assets (Create, Update, View, Delete). V2 Asset List APIs are already available. More info here: https://api.freshservice.com/v2/#assets
  • Software (Create, Update, View, List, Delete)




4 people like this idea

Simon, 


The APIs will allow you to get all the devices where a software is installed. You can also get all the software installed in a device. We are considering adding exports for SAM so that you can report on the information until we have SAM in analytics. More on this soon.


Best,

Sid

When are the full asset APIs, like create, update and delete going to be available.

Hi Jarrod, all the Asset APIs will be available early next week.



1 person likes this

Folks, I missed updating this thread. All the V2 APIs, except software, are now available. We haven't published the documentation for software APIs alone yet as there are a few changes planned in the Software module next month. I'll add a new post to track this item separately on the roadmap. Please let me know if there are any questions. 


Best,

Sid

Hi Sid,


Great work on the new API.

Wen retrieving a list of available asset types not all items seem to be returned. I'm missing certain categories like "Network" and custom created asset type categories. 


Are there any prerequisites for an asset type to be returned by the api? 


Regards,

Niels

Anyone on my question above?


Another question, does anyone know how to get full full contract details? I can get the contracts attached to an asset using "api/v2/assets/<display_id>/contracts/" but I can't find the contract start and end date.

Please help.

Hi Niels


Regarding your first question, make sure you read the bit about pagination. By default, the API returns a page of 30 objects, which in my test just now didn't include the 'Network' asset type. You can bump it out to a maximum of 100 objects per page by adding this parameter:

?per_page=100

That should probably be enough for asset types, unless you have a lot. But if you're querying any other objects that will return more than 100, you'll need to page your way through the results. Here's some sample Python code for doing that:

 

def get_asset_types():
    url = fs_base_url + '/api/v2/asset_types?per_page=100'
    # Loop through pages of 100 asset types
    while url:
        r = requests.get(url=url,
                         auth=(fs_api_key, fs_dummy_password))
        try:
            r.raise_for_status()
        except requests.exceptions.HTTPError as e:
            logging.error('Error: Couldn\'t get asset types: ' + e.message)
            return
        asset_types = r.json()
        for asset_type in asset_types['asset_types']:
            # Do stuff with each asset type
        # Grab the next page's URL from the response's link header. If none, we have reached the end.
        url = r.links.get('next', {}).get('url')
    return

HTH


Regards

Simon

Thanks for the reply Simon, we currently have 22 asset types so pagination shouldn't be an issue.

Login or Signup to post a comment
JS Bin