Skip to main content

Web API features and querystring filter options in REST API

Comments

4 comments

  • Harry Markarian

    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

    Originally posted on March 7, 2022.

    0
  • David Petty
    • Archer Employee

    @Anonymous, 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)

    Originally posted on March 7, 2022.

    0
  • Ricky Cartner

    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": [] } ]

    Originally posted on March 8, 2022.

    0
  • Harry Markarian

    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

    Originally posted on March 31, 2022.

    0

Please sign in to leave a comment.