How to search activities using user's login ID using REST API?

%3CLINGO-SUB%20id%3D%22lingo-sub-213904%22%20slang%3D%22en-US%22%3EHow%20to%20search%20activities%20using%20user's%20login%20ID%20using%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-213904%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20new%20to%20this.%20So%20far%20got%20few%20filters%20working%20with%20powershell.%3C%2FP%3E%3CP%3EBut%20I%20can't%20make%20it%20work%20with%20entity.%20For%20now%20I%20copied%20the%20entity%20ID%20from%20the%20portal's%20URL.%26nbsp%3B%20%3CSPAN%3EExample%3A%20%5B%7B%20%E2%80%9Cid%E2%80%9D%3A%20%E2%80%9Centity-id%E2%80%9D%2C%20%E2%80%9Csaas%E2%80%9D%3A%2011161%2C%20%E2%80%9Cinst%E2%80%9D%3A%200%20%7D%5D%3C%2FSPAN%3E).%26nbsp%3B%20Here%20is%20my%20query..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24Body%20%3D%20%40%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20limit%20%3D%2010%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20skip%20%3D%200%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20filters%20%3D%20%40%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20entity%20%3D%20%40%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20eq%20%3D%20'%5B%7B%22id%22%3A%22d75c39d9-0cd4-48cb-825c-9b6850ea0c3e%22%2C%22saas%22%3A%2211161%22%2C%22inst%22%3A%220%22%7D%5D'%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-213904%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECloud%20App%20Security%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-214258%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20search%20activities%20using%20user's%20login%20ID%20using%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-214258%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20am%20using%20powershell%20Invoke-RestMethod%20and%20kind%20of%20following%20this%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fyoutu.be%2FARUGBfu35zA%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fyoutu.be%2FARUGBfu35zA%3C%2FA%3E%20example.%26nbsp%3B%20Codes%20you%20mentioned%20I%20think%20for%20curl%2C%20as%20per%20API%20documentation.%20Not%20sure%20if%20they%20will%20work%20in%20powershell%20cmdlet.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAny%20idea%20how%20to%20search%20using%20UPN%20instead%20of%20entity%20ID%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-214196%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20search%20activities%20using%20user's%20login%20ID%20using%20REST%20API%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-214196%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Brajesh%2C%3C%2FP%3E%0A%3CP%3EThis%20filter%20accepts%20entity%20pksthat%20looks%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%7B%20%22id%22%3A%20%22entity-id%22%2C%20%22saas%22%3A%2011161%2C%20%22inst%22%3A%200%20%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20may%20use%20%E2%80%9Ceq%E2%80%9D%20or%20%E2%80%9Cneq%E2%80%9D%20with%20a%20list%20of%20entities%20pks%2C%20for%20example%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%7B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22skip%22%3A0%2C%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22limit%22%3A20%2C%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22filters%22%3A%7B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22entity.entity%22%3A%7B%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22eq%22%3A%5B%7B%22id%22%3A%22entity-id%22%2C%20%22saas%22%3A11161%2C%20%22inst%22%3A0%7D%5D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%7D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDima.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am new to this. So far got few filters working with powershell.

But I can't make it work with entity. For now I copied the entity ID from the portal's URL.  Example: [{ “id”: “entity-id”, “saas”: 11161, “inst”: 0 }]).  Here is my query..

 

$Body = @{
    limit = 10
    skip = 0
    filters = @{
        entity = @{
            eq = '[{"id":"d75c39d9-0cd4-48cb-825c-9b6850ea0c3e","saas":"11161","inst":"0"}]'
        }
    }
}

 

 

2 Replies

Hi Brajesh,

This filter accepts entity pksthat looks like this:

{ "id": "entity-id", "saas": 11161, "inst": 0 }

 

You may use “eq” or “neq” with a list of entities pks, for example:

{

    "skip":0,

    "limit":20,

    "filters":{

        "entity.entity":{

            "eq":[{"id":"entity-id", "saas":11161, "inst":0}]

        }

    }

}

 

Regards,

Dima.

I am using powershell Invoke-RestMethod and kind of following this https://youtu.be/ARUGBfu35zA example.  Codes you mentioned I think for curl, as per API documentation. Not sure if they will work in powershell cmdlet.

Any idea how to search using UPN instead of entity ID?