To fetch all access profiles with in particular application and users assigned to that access profiles

I want to fetch all access profiles with in particular application and users assigned to that access profiles through API

like
user1–>Access profile(AP)1,AP2,AP3–> X application
user 2–>Ap1–>X application
user3–>AP1,Ap2–>X application
user details should contain identities,application name,access profiles assigned for user

You can get all identities assigned to an application in the Search UI. When you download the report, you can see the access profiles assigned to each identity.

Using the Search API, you can provide the following body:

{
	"query": {
		"query": "@apps(name:aaaPhil Active Directory)"
	},
	"indices": [
		"identities"
	]
}

Hi Colin,Thank you for your reply I am able to get this output but it is getting other source access profiles,accounts,entities,roles,and application and i need to get which access profile assigned to which user within the application.

Are you trying to generate a list of identities that have been granted an application?

appliction (AD) has list of identies(user1,user2,user3) and list of access profiles(AP1,AP2,AP3)
expected output is I need to fetch list access profiles application (AD)has and user assigned to that access profiles within Applicatio(AD)
application AD–>3access profile(AP1,AP2,AP3)
AP1–assigned–>user1,user2
Ap2–assigned–>user1
Ap3–assigned–>user3
or
application AD–>3access profile(AP1,AP2,AP3)
user1–Assigned–>AP1,AP2
user2–assigned–>AP1
user3–assigned–>AP3
like these output I am trying to get through API