Query API outputs "Viewing this query is not yet supported" for some requests

Options

Can someone clarify if the Query API supports all query types yet? I'm just picking random query IDs for it to pull up. Sometimes, it works, but for others, BB's server simply responds with a 400 error saying “Viewing this query is not yet supported.”

Comments

  • @Ramon Carroll
    are you speaking about Query API or Query in webview. if Query API, how are you running the API and which endpoint call gives you an error?

    As I mention in your other post, i have not encounter a situation where I cannot execute a query by query id using Query API.

  • @Alex Wong

    5b0ac167508bedd9aa79003d7c10bcba-huge-im

    Thanks for the response! Yes, I'm referring to the Query API in particular. I haven't actually run it from a script yet. I'm just testing it from the SKY Developer API reference app. I've found that some query IDs return the JSON data, however, when I use the ID of one of my most used gift queries (I used to have Power Automate retrieve it from the FTP folder it exports to and then send it to a data source that Power BI uses), I get this above.

    Regarding the Query in Web View, I don't unfortunately have access to it yet. Hopefully, that will change soon.


  • @Ramon Carroll
    can you screenshot and show the full request, including URL, query parameter, and request body.

    For the gift query you were trying to do, can you tell me what fitler field, output field, and sort field you are using. I will try to replicate

  • @Alex Wong
    I'm using the API Reference app here: https://developer.sky.blackbaud.com/api#api=query&operation=GetQueryById

    Here, below, is the screenshot of the actual request that the app sent, which returned the previously mentioned results.

    9018cfa544f2448a3dcae6bbcc07ae2c-huge-im

    Here are the filter fields:

    556c56d7204de699da92fe2ec77807c3-huge-im

    Output:

    5d30a371cfffeded00828341c21346f9-huge-im

    No Sorting was done.

    Please feel free to let me know if you need anything else.

  • @Ramon Carroll
    Hi, looks like you are using the Get Query endpoint, not sure what you want to do with calling this endpoint, which basically only give you the query definition in JSON format, not actually running the query to get result.

    I created the same exact query (well mostly, i do not have your fund attribute, but used a different fund attribute) and get the same error trying to use the Get Query API endpoint, but I have no problem running the query and getting its result.

    f68b7c2f45aa6013a5dd52dfd9ee64e8-huge-im
    c6ffca44693df0b9f3f58c885ce06198-huge-im

    9bd75f22afc81d7868ef5368a3e7bc13-huge-im
    471ba52c8ff4533809842efe169f1936-huge-im
    sas_uri is the URL to download the results
  • @Alex Wong
    Ah okay, apparently, I allowed myself to get fixated on this one as a “GET” method and didn't read the documentation clearly after that. It looks like what I was looking for was the query job execution request, which is a POST method. I probably would have eventually figured this out once I took the time to actually read through the docs more carefully, but you saved me a lot of unnecessary frustration! lol

    I'll try to test this out and let you know if I run into any issues. Thank you, again, for your help, and for your patience.

  • @Alex Wong

    I feel like I'm really close to a successful test here, but I've run into what looks to be one final snag.

    So, I've built a script that sends a POST request to execute a query job, (using the existing query ID), and as expected, it returns a JSON object containing the job id (randomized string) and a job status ("Pending"). All good, that part of the script seems to be working fine.

    Here's the API docs page I'm referencing for this part.

    However, when I then pass the id into a GET request for the job execution status (so that I can determine when the query job is complete, as well as the URL for where the results will be hosted), I'm simply getting a “404 Client Error: Resource Not Found for URL” error. An example is here:

    HTTPERROR: 404 Client Error: Resource Not Found for url:

    Here's the API docs page I'm referencing for this part.

    I've been looking at this for some time now, but I cannot figure out what I'm doing wrong, so I'm looking for a fresh pair of eyes here. The job ID I'm using looks like it should work, considering that the BB server successfully returned the information on my initial POST request. Is there anything that you can see that is missing in what I'm doing?

    Here are the outputs I'm printing to the console. Right after the last line is where I get the 404 error:

    a821d276ac11038830bff9455392ff85-huge-im
    This is my console log output that I added to the script.
  • @Ramon Carroll
    how are you calling the get execution job status. please provide the full request.

    here's my POST to execute query by id's request body:

    {
    "id": 63525,
    "ux_mode": "Asynchronous",
    "formatting_mode": "None",
    "sql_generation_mode": "Export",
    "output_format": "JSON"
    }

    ux_mode should always use Asynchronous in my opinion, but you can read the difference and make your own determination.

    here's my GET to get job status query parameters:

    {
    "product": "RE",
    "module": "None",
    "include_read_url": "OnceCompleted",
    "content_disposition": "Attachment"
    }

  • @Alex Wong

    For the POST:

    URL: "https://api.sky.blackbaud.com/query/queries/executebyid"

    Query Parameters: {
    "product" : "RE",
    "module" : "None"
    }

    Request Body: {
    "id" : "51089"
    }

    _______________________________________________________________________

    For the GET:

    URL: “https://api.sky.blackbaud.com/query/jobs/

    Query Parameters: {
    "product" : "RE",
    "module" : "None",
    "include_read_url" : "OnceCompleted",
    "content_disposition" : "Inline"
    }

  • @Ramon Carroll
    I don't know what defaults are used when you do not specify the parameter that may affect this.

    Why POST execute query by id using the same parameter I have (excep the query id of course), and then use the same parameter for the get job status too

  • @Alex Wong
    Well, I was going by the API documentation regarding the defaults, so I didn't think that I would need to explicitly define them if I were okay with their default values. However, it's still a good suggestion, at least for troubleshooting purposes. Some of your values seem different from the defaults, but I'll still select the ones you've picked. I'm assuming that this is what you are asking me to do:

    Here's the request body data for the query execution request (POST):

    {
    "id" : "51089",
    "ux_mode" : "Asynchronous",
    "formatting_mode" : "None",
    "sql_generation_mode" : "Export",
    "output_format" : "JSON"
    }

    And then the params:

    {
    "product" : "RE",
    "module" : "None"
    }

    ______________________________________________________________________________________________

    Here are the params for the query job status request (GET). Note, there is no request body, of course, since that is not listed as a requirement in the docs:

    {
    "product" : "RE",
    "module" : "None",
    "include_read_url" : "OnceCompleted",
    "content_disposition" : "Attachment"
    }

    Same issue and same error, unfortunately…

  • @Alex Wong

    I finally figured out what it was. It was a bug in my code, not in the query parameters or body. The latter request, which is supposed to be a GET request, was being sent as a POST. I've corrected it, and it's now working. Thank you!

  • @Ramon Carroll
    great that you got it working

    now that you got it working, here's a post for you to read up a bit on the different status and what you may want to do when encountered

  • @Alex Wong
    Thank you!

    I looked at your solution and noticed that it's not too different from what I already came up with in my Python code. My loop is similar to your ‘Do While’ loop, except my code is running the status check every 15 seconds (and logging the status result) until the result is not “Pending”, “Running”, or “Throttled”. I see that you are adding a longer delay if the job has been throttled, and that makes a lot of sense. Just curious, are you just doubling or tripling the wait time for that status?

    The images you posted in the link you referenced no longer display, so if the answer is there, I can't see it.

  • @Ramon Carroll
    Blackbaud recommends (does not restrict) that checking for job completion to be no less than 30 seconds, I do not know if you check too often that will result in job being throttled or not, so I stick with at least 30 seconds. For query I know will run longer after a few test, I adjust the interval wait time accordingly, sometime 60s or 90s even.

    As for when a job is throttled, I will double the time.

Categories