How to perform a GET request to a HTTPS endpoint using Android Studio

Hello!

I am trying to query:

https://app_id.data.site.org/api/v2/query/device_id?last=20s

and I need to pass the access key (which I have) somehow on the end of that address. I thought it might be like:

https://app_id.data.site.org/api/v2/query/device_id?last=20s&key=access_key.

However, I am still not authorized. It’s got to be something simple I am messing up; I just can’t see it!

I do have Data Storage integrated. The above is from Swagger. Or maybe there is a better way?

I do have the curl on command line working perfectly:

curl \ --header “Content-Type: application/json” \ --header “Authorization: key key_here” --request GET \ https://app_id.data.site.org/api/v2/query/device_id?last=20s

I am trying to either implement the request in the Android app or implement the curl in the Android app.

Any help would be appreciated!

Greg.

It’s not clear what if anything this has to do with TTN or why you posted it here.

While some servers will allow either, headers are quite distinct from URL parameters. You should spend some time researching ways to set HTTP headers in Java on Android in the various libraries available for making HTTP request - that is a very common need for RESTful APIs for which you will find quite a bit of support.

Note that “Android Studio” is neither a programming language nor set of APIs to program against - it is merely an IDE or work environment, and as such is not a suitable title or search term for your problem.

1 Like

Hello,

Thanks for your reply. First off, I of course know that Android Studio is an IDE. I was just reaching out in case you knew how to query an API via HTTPS. Looks like you don’t deal with that, so I will continue my research. Thanks for your reply.

Greg.

1 Like