Explore the JWQL API



What is the JWQL API?


JWQL allows users to access the data available through our programmatic Application Programming Interface (API). In short, an API accepts requests for services from a system, gathers the items in the request, and returns a response to the user. A popular example used to describe the functionality of an API is describing the role of a waiter in a restaurant. When you enter a restaurant and sit at your table, you are typically provided a menu containing all of the drink and food options. But how do you communicate your food and drink order to the kitchen staff? This is where the waiter (API) comes in, you provide the waiter with your order (request), they will communicate your order to the kitchen staff (system), and bring your food and drinks when they are prepared (the response). The waiter (API) disguises all of the steps that are necessary to getting your final product delivered (cooking the food, counting stock, knowing recipes, etc.) but, is the link to the user and the response they wish to obtain from a system.


Examples


Here we showcase a few examples of a few of the APIs that we offer. To see a full list of supported APIs click here.


Obtaining Filenames Associated with a Rootname

A user is interested in all of the filenames associated with a specific JWST rootname.

                
                    from urllib import request
                    import json

                    # Build the URL https://jwql.stsci.edu/api/roontname/service/
                    url = 'https://jwql.stsci.edu/api/jw93025001001_02102_00001_nrca2/filenames/'
                    req = request.urlopen(url)
                    filenames = json.loads(req.read().decode())

                    print(filenames)

                    {'filenames': ['jw93025001001_02102_00001_nrca2_calints.fits',
                                    'jw93025001001_02102_00001_nrca2_rate.fits',
                                    'jw93025001001_02102_00001_nrca2_rateints.fits',
                                    'jw93025001001_02102_00001_nrca2_trapsfilled.fits',
                                    'jw93025001001_02102_00001_nrca2_uncal.fits']}
                    
             
Obtaining Thumbnails with Instrument Name

A user is interested in all of the thumbnail associated with the Fine Guider Sensors (FGS).

                    
                    from urllib import request
                    import json

                    # Build the URL https://jwql.stsci.edu/api/instrument/service/
                    url = 'https://jwql.stsci.edu/api/fgs/thumbnails/'
                    req = request.urlopen(url)
                    thumbnails = json.loads(req.read().decode())

                    print(thumbnails)

                    {'thumbnails': ['jw97012001003_02101_00001_guider1_trapsfilled_integ2.thumb',
                                    'jw97012001001_02101_00001_guider1_rateints_integ1.thumb',
                                    'jw97012001002_02101_00001_guider1_trapsfilled_integ2.thumb',
                                    'jw97012001004_02101_00001_guider1_rateints_integ0.thumb',
                                    'jw97012001003_02101_00001_guider1_rateints_integ0.thumb',
                                    'jw97012001001_02101_00001_guider1_cal_integ0.thumb',
                                    'jw97012001001_02101_00001_guider1_rateints_integ0.thumb',
                                    'jw97012001004_02101_00001_guider1_rate_integ0.thumb',
                                    'jw97012001004_02101_00001_guider1_trapsfilled_integ0.thumb',
                                    'jw97012001001_02101_00001_guider1_trapsfilled_integ1.thumb',
                                    'jw97012001004_02101_00001_guider1_trapsfilled_integ1.thumb',
                                    ...,
                                    ...]}
                        
                    
Obtaining Filenames with Proposal ID

A user is interested in all of the thumbnail associated with the Fine Guider Sensors (FGS).

                        
                        from urllib import request
                        import json

                        # Build the URL https://jwql.stsci.edu/api/proposal/service/
                        url = 'https://jwql.stsci.edu/api/86600/filenames/'
                        req = request.urlopen(url)
                        filenames = json.loads(req.read().decode())

                        print(filenames)

                        {'filenames': ['jw86600001001_02101_00001_guider1_cal.fits',
                                       'jw86600001001_02101_00001_guider1_rate.fits',
                                       'jw86600001001_02101_00001_guider1_trapsfilled.fits',
                                       'jw86600001001_02101_00001_guider1_uncal.fits',
                                       'jw86600001001_02101_00002_guider1_cal.fits',
                                       'jw86600001001_02101_00002_guider1_rate.fits',
                                       'jw86600001001_02101_00002_guider1_trapsfilled.fits',
                                       'jw86600001001_02101_00002_guider1_uncal.fits',
                                       'jw86600001001_02101_00003_guider1_cal.fits',
                                       'jw86600001001_02101_00003_guider1_rate.fits',
                                       'jw86600001001_02101_00003_guider1_trapsfilled.fits',
                                       'jw86600001001_02101_00003_guider1_uncal.fits',
                                       'jw86600001001_02101_00004_guider1_cal.fits',
                                       'jw86600001001_02101_00004_guider1_rate.fits',
                                       'jw86600001001_02101_00004_guider1_trapsfilled.fits',
                                       ...,
                                       ...]}
                        
                    

List of Available Services


Where <instrument>, <rootname>, <proposal> are the values for the instrument name, rootname and proposal ID respectivly