Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Web API features and querystring filter options in REST API

PremRajani
Collaborator II

Hi,

Few features in Web API is not available in REST API and it would be better to bring in those too. Something like SearchRecordsByReport, BulkCreate & BulkUpdate.

Another good feature is to include querystring option to those where we anticipate huge response result. For example getting all users is time consuming and unless otherwise required every time, better to fetch based on certain criteria. Let's say it makes sense to get users of particular domain or those that were created current date. If timeout is not provided, then trying to fetch users/roles etc always faults in time out error.

Thanks,

Prem

4 REPLIES 4

DavidPetty
Archer Employee
Archer Employee

@PremRajani, what you're asking is more of Idea and then a discussion.

Though there are a few Ideas out there you can Like, Feature Parity between REST and SOAP APIs - Archer Community - 579853 (archerirm.community)

Create REST API functionality to perform record searches and run reports - Archer Community - 574447 (archerirm.community)

The REST APIs do support ODATA for filtering and such, Open Data Protocol (OData) (archerirm.cloud)

 Advisory Consultant

Hi David,

Thanks for responding quickly, but it doesn't contain querystring like ?createdate>3/6/2022...for getting all the users. It would be helpful rather than getting all users and then applying filters.

Apologies if user querystring is already available and I overlooked it.

Thanks,

Prem

What you're trying to do (it seems) is filter by fields within the "RequestedObject" field, ie. DisplayName, FirstName, LastName, UserName, etc. But you also want to apply a filter on the nested object "UpdateInformation" that includes the CreateDate, UpdateDate, CreateLogin, and UpdateLogin. 

This would normally require the use of the ODATA nested filter called $expand. This was introduced fairly recently and is not currently available for use in Archer. The workaround is to reference the parent object/child object like this: UpdateInformation/CreateLogin

Be sure to include "datetime" to convert the value into the correct data type. The results below filter by Name and then by CreateDate. 

Example: 

/api/core/system/user?$filter=LastName eq 'User1' and UpdateInformation/CreateLogin gt datetime'2022-03-06'

==============
RESULTS
==============
[
  {
    "Links": [],
    "RequestedObject": {
      "DisplayName": "User1, Mike",
      "FirstName": "Mike",
      "LastName": "User1",
      "UserName": "AJ01",
      "UpdateInformation": {
        "CreateDate": "2020-03-24T09:25:46.043",
        "UpdateDate": "2021-01-18T10:27:35.54",
        "CreateLogin": 185,
        "UpdateLogin": 185
      }
    },
    "IsSuccessful": true,
    "ValidationMessages": []
  }
]

 

To find all records created after a specific date, just exclude the LastName filter:

/api/core/system/user?$select=DisplayName,FirstName,LastName,UserName,UpdateInformation&$filter=UpdateInformation/CreateDate gt datetime'2020-03-24'

==============
RESULTS
==============
[
  {
    "Links": [],
    "RequestedObject": {
      "DisplayName": "User1, Mike",
      "FirstName": "Mike",
      "LastName": "User1",
      "UserName": "AJ01",
      "UpdateInformation": {
        "CreateDate": "2020-03-24T09:25:46.043",
        "UpdateDate": "2021-01-18T10:27:35.54",
        "CreateLogin": 185,
        "UpdateLogin": 185
      }
    },
    "IsSuccessful": true,
    "ValidationMessages": []
  },
  {
    "Links": [],
    "RequestedObject": {
      "DisplayName": "User2, Amber",
      "FirstName": "Amber",
      "LastName": "User2",
      "UserName": "US18",
      "UpdateInformation": {
        "CreateDate": "2020-03-24T09:25:53.073",
        "UpdateDate": "2022-03-08T16:48:03.36",
        "CreateLogin": 185,
        "UpdateLogin": 185
      }
    },
    "IsSuccessful": true,
    "ValidationMessages": []
  }
]

 

Hi Ricky,

Thanks for the help, didn't get chance to try it since was busy fixing the API connection issue. Will try and let you the results.

 

Thanks,

Prem