Developer

 View Only
last person joined: 10 hours ago 

Expand all | Collapse all

ClearPass API Static Host List

This thread has been viewed 12 times
  • 1.  ClearPass API Static Host List

    Posted Mar 25, 2024 08:08 AM

    Hi,

    I need to update a static host List in Clearpass with API but I receive an error 400 : The request sent by the client was syntactically incorrect.

    I don't find the correct value to send. 

    With Update some fields of a static host list by name (arubanetworks.com), the payload in pyhton is :

    payload = {
        "host_entries": {
            "A0-B0-C0-D0-00-01": "device1",
            "A0-B0-C0-D0-00-02": "device2",
            "A0-B0-C0-D0-00-03": "device3"
        },
        "host_format": "list",
        "host_type": "MACAddress"
    }

    But in the description : :[{"host_address": "10.21.11.117", "host_address_desc" : "My host address description."}, {..} ..]. I have try few thins without success. Someone know the correct format ?


    Thanks.



  • 2.  RE: ClearPass API Static Host List

    EMPLOYEE
    Posted Mar 25, 2024 08:28 AM

    What works many times, is to retrieve an object (static hostlist in your case) via the API and get/use to format from there.

    {
      "id": 3003,
      "name": "TestSHL",
      "description": "Test",
      "host_format": "list",
      "host_type": "MACAddress",
      "host_entries": [
        {
          "host_address": "00-00-11-11-22-22",
          "host_address_desc": "Test1"
        },
        {
          "host_address": "11-22-33-44-55-66",
          "host_address_desc": "Test2"
        }
      ],
    }

    That would be the format/structure to build in python. You can check the format with print(json.dumps(payload)), and make sure the {} and [] and "label": are all in the right place.

    Note that Static Host lists are most times not the best way of achieving a result. Using the Endpoint Database or Guest Device database (with attributes) is the more mainable approach.



    ------------------------------
    Herman Robers
    ------------------------
    If you have urgent issues, always contact your Aruba partner, distributor, or Aruba TAC Support. Check https://www.arubanetworks.com/support-services/contact-support/ for how to contact Aruba TAC. Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or Aruba Networks.

    In case your problem is solved, please invest the time to post a follow-up with the information on how you solved it. Others can benefit from that.
    ------------------------------



  • 3.  RE: ClearPass API Static Host List

    Posted Mar 25, 2024 09:21 AM

    Hi Herman,

    Really thanks for your answer. 

    We will see if we change our methods some whitelists.