View api calls - Gargravarr2112/vFense GitHub Wiki

All arguments must be added into the payload for all POST, PUT, and DELETE http methods.


Fetch Views

uri = /api/v1/views http method = GET

key value_type example_value default required
view_context string test None False
parent_view string global false False
query str ^]w+_admin None False
count integer 30 30 False
offset integer 0 0 False
sort str asc or desc asc False
sort_by str view_name view_name False

Example of what this api returns

{
    "count": 1, 
    "vfense_status_code": 1001, 
    "uri": "/api/v1/views", 
    "http_method": "GET", 
    "http_status": 200, 
    "message": "dataset retrieved", 
    "data": [
        {
            "cpu_throttle": "normal", 
            "ancestors": [], 
            "agent_queue_ttl": 10, 
            "parent": null, 
            "token": "uQ7X5ijyovQTkkRuCUraj83l7wuLkr6cAwKwpbgVqcY", 
            "server_queue_ttl": 10, 
            "package_download_url_base": "https://10.0.0.17/packages/", 
            "view_name": "global", 
            "groups": [
                {
                    "group_id": "3b004b3c-2d62-469f-94f6-5b1fda3a2692", 
                    "group_name": "Global Read Only"
                }, 
                {
                    "group_id": "ba9bc494-43b9-4805-9321-a9ed123e3c93", 
                    "group_name": "Global Administrator"
                }
            ], 
            "previous_tokens": [], 
            "net_throttle": 0, 
            "children": [], 
            "users": [
                {
                    "user_name": "global_admin"
                }
            ]
        }
    ]
}

Create View

uri = /api/v1/views http method = POST

key value_type example_value default required
view_name string Miami True
parent_view string global the current view False
download_url string https://10.0.0.17/packages the download url for the global view False
net_throttle integer 100 (The number is in kb) 0 False
cpu_throttle string normal (idle, normal, below_normal, above_normal, high) normal False
server_queue_ttl integer 20 (Number of minutes unto the queue expire for an agent 10 False
agent_queue_ttl integer 10 ( Number of minutes until an operation expires on the agent 10 False
time_zone string America/Argentina/La_Rioja UTC False

Example of what this api returns

Delete Views

uri = /api/v1/views http method = DELETE

key value_type example_value default required
view_names list [linuxdynasty, foo, bar] True

Example of what this api returns


Managing a view

The api calls below have to deal with editing a view

Edit properties of a view

uri = /api/v1/view/view_name_goes_here http method = PUT

key value_type example_value default required
download_url string https://10.0.0.17/packages the download url for the global view False
net_throttle integer 100 (The number is in kb) 0 False
cpu_throttle string normal (idle, normal, below_normal, above_normal, high) normal False
server_queue_ttl integer 20 (Number of minutes unto the queue expire for an agent 10 False
agent_queue_ttl integer 10 ( Number of minutes until an operation expires on the agent 10 False
time_zone string America/Argentina/La_Rioja UTC False

Example of what this api returns

Adding or removing of users from a view.

uri = /api/v1/view/view_name_goes_here http method = POST

key value_type example_value default required
action string add (add or delete) add True
usernames list of strings [linuxdynasty, humchacon] False

Example of what this api returns

Adding or removing of groups from a view.

uri = /api/v1/view/view_name_goes_here http method = POST

key value_type example_value default required
action string add (add or delete) add True
group_ids list of strings [ba9bc494-43b9-4805-9321-a9ed123e3c93] False