Forum Discussion

MyThumbsClick's avatar
MyThumbsClick
Helper II
2 years ago
Solved

using a colon in a Query - Invalid Identifier

Hi

I have a query setup to a json API source and i want to filter the query by department ID. the API developer reference states the format as /api/v2/agents?query=department_id:123456 which works testing in a web browser. However the below Advanced Editor code fails with an invalid identifier. If i switch the : to a =, the query syntax is happy but fails to get contents because the API needs a :

Do you have any suggestions on how i can get around this?

 

 

let
    Source = Json.Document(Web.Contents(FreshserviceBaseURL,
        [RelativePath="/Agents?",
        Query=[department_id: "12456798"]])) 
in 
    Source

 

 

  • MyThumbsClick's avatar
    MyThumbsClick
    2 years ago

    Got there in the end. I was missing query at the start of the filter. Thanks for your help

     

     

5 Replies

  • let
        Source = Json.Document(Web.Contents(FreshserviceBaseURL,
            [RelativePath="Agents",
            Query=[#"department_id": "12456798"]])) 
    in 
        Source
      • lbendlin's avatar
        lbendlin
        Super User
        let
            Source = Json.Document(Web.Contents(FreshserviceBaseURL,
                [RelativePath = "Agents",
                Query = [#"department_id" = "12456798"]])) 
        in 
            Source