Download results of Query with SAS URI

I am downloading a CSV file produced by the “Query execution job (Ad-hoc)” API. I get the SAS URI and I am able to download the file using a browser or curl, but not when I try it in a Groovy application.

I get the “403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.” which seems to be a common error with many causes.

Any ideas?

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 bbcon 2025 Attendee Badge

    @Kenneth Staudt
    As you said, the sas_uri if you copy it out and put in browser, you are able to download, so there's no problem with the process.

    I do not know what Groovy application is, but you should know that the sas_uri is not “live” forever. Currently the time limit is 15 min and it will expire, which may be the reason for your error.

    SAS URI for accessing the query results. The URI functions as a secure credential to access the query results, and thus should be considered a secret unique value. Sharing this URI with anyone is strongly discouraged, and as a best practice, avoid persisting the URI beyond processing the job result. The URI will expire after 15 minutes.

    https://developer.sky.blackbaud.com/api#api=query&operation=GetJob

  • @Alex Wong
    Thanks Alex. I am definitely using the URL before the fifteen minutes are up.

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 bbcon 2025 Attendee Badge

    @Kenneth Staudt
    the sas_uri is simply URL that requires no header or authentication info, as you can probably tell from when you attempt to use the url directly in a browser, so it should simply work. So the only issue lies then in what this Groovy application is.

    If you think it may be other “factors” you can try copying the link and use it in different browser, and before “hitting” enter after pasting the URL, open the browser's inspector, you can see if the “request” does anything “extra”.

    If you know how to do programming in any other language, you can try to access the URL directly using another programming language to see if it works.