Expand my Community achievements bar.

Running a Query from the sandbox using Python API Call

Avatar

Level 2

Hi All,

 

Query Service API :https://developer.adobe.com/experience-platform-apis/references/query-service/ 

 

The above link tells us to trigger a scheduled query, is there a way we can trigger a query from an API without scheduling it??

 

Thanks

Gouri Raula

1 Reply

Avatar

Level 3

Hi @gugun ,

Following query service end point submit your query to AEP and return query id with status code "202 Submitted". Upon successful submission, your query went through multiple phases like "In-Progress/Success/Failed/Killed/Timeout".

1] Query Submission end point (No need to trigger, it automatically queued for execution)

https://platform.adobe.io/data/foundation/query/queries

payload : 

{
        "dbName""<dbname>",
        "sql""<Query>",
        "name""Test Query",
        "description""Test Query Description"
 }
Response :
vikash4_1-1677517482958.png

 


2] Check Status of Query with Query Id after some interval

End Point : https://<domain>/data/foundation/query/queries/c055faa5-87be-44ec-a240-44e572296aa3

Iteration Response1 : 

vikash4_2-1677517618584.png

 

Iteration 2 Response: In my case, query got failed and it return "Failed" status.

vikash4_3-1677517762237.png

 

 if you're accessing these api from Python, it would be good to allow some time to finish the query execution to get the query result. or you can also use polling feature. Hope this helps:)

Thanks.