Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
CORB
Helper I
Helper I

Amend API query to return multiple statuses

Hi 

I'm new to Power Query and have written the following to extract data from a time recording app we use called Clockify.

 

(Page as text) =>

let
Source = Json.Document(
Web.Contents("https://api.clockify.me/api/v1" & "/workspaces/"& Workspace&"/approval-requests?page="&Page&"&page-size="&PageSize&"&status="&Status,
            [Headers=[#"X-API-Key"=#"X-API-Key", 
                     #"Content-Type"="JSON"]]
                                      )
                                       ),

I need to return records for all status codes (APPROVED,PENDING,REJECTED,WITHDRAWN_APPROVAL) however I don't understand how to structure the query to include an OR clause. At the moment I have a parameter called Status and the query works fine  if populate with one of the statuses e.g. APPROVED. The API has a default value of PENDING, so only returns those records if Status is omitted from query.

 

Be grateful for any help or advice anyone can offer.

Best regards

Mark

 

 

 

 

 

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Does the documentation for this API provides the syntax for or ? Alternatively, you can make a one column table of the your status values and then invoke your function in a new column, passing the status values in on each row.

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
CORB
Helper I
Helper I

Hi Pat

 

I have questioned the syntax provided by Clockify and they now advise that returning multiple status is not supported so request must be made for each status separately.

 

I will close this query now and go away and research how I can do this, and submit another question if I can't figure it.

 

Thanks again 

 

Mark

 

 

CORB
Helper I
Helper I

Hi Pat 

Thanks for the reply.

 

The syntax I've been provided with is as follows

 

CORB_0-1646735993003.png

 

I've tried passing everything following the "=" sign in the parameter but only get records returned for the first status.

 

Could you please elaborate on your suggestion regarding the one column table as it's above my current level of knowledge.

 

Many thanks for your help.

 

Best regards

 

Mark

 

 

 

 

 

mahoneypat
Employee
Employee

Does the documentation for this API provides the syntax for or ? Alternatively, you can make a one column table of the your status values and then invoke your function in a new column, passing the status values in on each row.

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors