Question - API call / how to link dynamic status to compliance management?

Hi,

I’m working my way through the API documentation to build an internal proof of concept based on the data on your demo site.

I’m looking for the label “Control last audit expired” in this view.

I have queried compliance-managements/index and receive all the data in the format I expect. I’ve also queried the compliance-managements/dynamic-statuses endpoint and receive, among other items, this data which I believe is what I’m looking for.

        {
            "id": 151,
            "slug": "SecurityService-current_audit_expired",
            "name": "Control Last Audit Expired",
            "description": null,
            "model": "ComplianceManagements",
            "field": null,
            "type": 1,
            "color": "#FF9800",
            "status": 1,
            "created": "2022-09-09T14:08:11+02:00"
        },

A theory I have is that I want to look in the compliance-managements/{foreign_key}/dynamic-status-values endpoint but this is where I’m lost. I’m regardless what foreign key I put in, I get the same result back:

{'data': [{'dynamic_status_id': 145, 'foreign_key': 1, 'id': 1450, 'value': 0},
          {'dynamic_status_id': 146, 'foreign_key': 1, 'id': 1451, 'value': 0},
          {'dynamic_status_id': 147, 'foreign_key': 1, 'id': 1452, 'value': 0},
          {'dynamic_status_id': 148, 'foreign_key': 1, 'id': 1453, 'value': 0},
          {'dynamic_status_id': 149, 'foreign_key': 1, 'id': 1454, 'value': 0},
          {'dynamic_status_id': 150, 'foreign_key': 1, 'id': 1455, 'value': 0},
          {'dynamic_status_id': 151, 'foreign_key': 1, 'id': 1456, 'value': 0},
          {'dynamic_status_id': 152, 'foreign_key': 1, 'id': 1457, 'value': 0},
          {'dynamic_status_id': 153, 'foreign_key': 1, 'id': 1458, 'value': 0},
          {'dynamic_status_id': 154, 'foreign_key': 1, 'id': 1459, 'value': 0},
          {'dynamic_status_id': 155, 'foreign_key': 1, 'id': 1460, 'value': 0},
          {'dynamic_status_id': 156, 'foreign_key': 1, 'id': 1461, 'value': 0},
          {'dynamic_status_id': 157, 'foreign_key': 1, 'id': 1462, 'value': 0},
          {'dynamic_status_id': 158, 'foreign_key': 1, 'id': 1463, 'value': 0},
          {'dynamic_status_id': 159, 'foreign_key': 1, 'id': 1464, 'value': 0},
          {'dynamic_status_id': 160, 'foreign_key': 1, 'id': 1465, 'value': 0},
          {'dynamic_status_id': 214, 'foreign_key': 1, 'id': 3576, 'value': 0},
          {'dynamic_status_id': 215, 'foreign_key': 1, 'id': 3703, 'value': 0},
          {'dynamic_status_id': 216, 'foreign_key': 1, 'id': 3830, 'value': 0},
          {'dynamic_status_id': 217, 'foreign_key': 1, 'id': 3957, 'value': 0},
          {'dynamic_status_id': 218, 'foreign_key': 1, 'id': 4084, 'value': 0},
          {'dynamic_status_id': 219, 'foreign_key': 1, 'id': 4211, 'value': 0},
          {'dynamic_status_id': 224, 'foreign_key': 1, 'id': 8201, 'value': 0},
          {'dynamic_status_id': 225, 'foreign_key': 1, 'id': 8328, 'value': 0},
          {'dynamic_status_id': 287,
           'foreign_key': 1,
           'id': 32727,
           'value': 0}],
 'pagination': {'count': 25,
                'current_page': 1,
                'has_next_page': False,
                'has_prev_page': False,
                'limit': 100,
                'page_count': 1},
 'success': True}

Can you please suggest how I would go about fetching the dynamic status data for each item in the compliance analysis view (ie Eramba)?

Thank you.

Please advise if this question is not in line with posting requirements or if the information is obvious in docs and I’ll have another look. I wasn’t able to figure it out when playing around though. :confused:

Hello,

Instead of a foreign key, you have to put in a compliance management ID which you get from the compliance management index. You should get the list of dynamic status values for the selected item.

Hi,

I might have figured it out now. Just to make sure: I’m doing this against the API of your public demo site:

  • Querying /api/compliance-managements/index. In the data response, there is a Segration of duties Item name, having id=3 in the JSON response. This line reads as CONTROL LAST AUDIT EXPIRED in the demo site.
  • I’m then querying /api/compliance-managements/3/dynamic-status-values, as I believe 3 is the compliance management ID I want to reference. This returns a JSON response with a list of objects like this (List A):
{
      "id": 2548,
      "dynamic_status_id": 145,
      "foreign_key": 3,
      "value": 0
    },
    {
      "id": 2557,
      "dynamic_status_id": 154,
      "foreign_key": 3,
      "value": 0
    }

This is where I’m lost. Am I then supposed to query ​/api​/compliance-managements​/dynamic-statuses​/145? I’m seeing those responses as:

{
  "success": true,
  "data": {
    "id": 145,
    "slug": "ComplianceAnalysisFinding-expired",
    "name": "Finding Expired",
    "description": null,
    "model": "ComplianceManagements",
    "field": null,
    "type": 1,
    "color": "#FF9800",
    "status": 1,
    "created": "2022-09-09T14:08:09+02:00"
  }
}

And

{
  "success": true,
  "data": {
    "id": 154,
    "slug": "RiskReview-expired",
    "name": "Asset Risk Review Expired",
    "description": null,
    "model": "ComplianceManagements",
    "field": null,
    "type": 1,
    "color": "#FF9800",
    "status": 1,
    "created": "2022-09-09T14:08:13+02:00"
  }
}

Finding Expired not the exact same label as in the GUI but quite similar. I’m not seeing Asset Risk Review Expired though. And this somewhat confuses me.

Edit: added the response for id=154

1 Like

@sam I’m sorry, but I’m not quite able to figure this out yet. How come the /api/compliance-managements/{foreign_key}/dynamic-status-values endpoint returns the same response regardless of what foreign_key I use?

If I use foreign_key=1 (which I believe would be for Policies for information security) I get the same result as for foreign_key=3 (Segregation of duties). Where am I going wrong here?

I’m a little bit lost too haha. Maybe we can discuss it on a call if it is easier.

If I use foreign_key=1 (which I believe would be for Policies for information security ) I get the same result as for foreign_key=3 (Segregation of duties).

This is correct


How come the /api/compliance-managements/{foreign_key}/dynamic-status-values endpoint returns the same response regardless of what foreign_key I use?

I’m getting different values


For example definition of status 145:

Thank you for getting back to me! I’m currently not in the office but will try this in my own dev environment when I get back beginning of August.

@sam using our enterprise license, I was able to test this on data I’m more familiar with and got it to work as expected. Your last reply here was very helpful in guiding me into the right path. Thank you!

1 Like