This site is for informational purposes only. Please note that NEWT has been retired. The Superfacility API now provides a newer set of programmatic web interfaces to access NERSC.

 What is NEWT?

NEWT is bringing High Performance Computing (HPC) to the web through easy to write web applications. We think that writing applications for the web should be a simple task. We want to make HPC resources accessible and useful to scientists who are more comfortable with the web than they are with compilers, batch queues, or punched cards. Thanks to Web 2.0 APIs, we believe HPC can speak the same language as the web.


NEWT is a web service that allows you to access computing resources at NERSC through a simple RESTful API. The NEWT API and web service will let you interact with NERSC through simple HTTP urls and commands. NEWT responds to client requests using JSON. This makes it very easy to build powerful web applications using nothing but HTML and Javascript.


NEWT currently exposes the following services over the web (some services require authentication):

NEWT consists of two parts:

 Hello World (AJAX)

In order to build a simple "Hello World" app, you will need access to a web server that can host your HTML page. Include newt.js in the <head> section of your HTML page. This will give you a form bar that handles that intricacies of logging in to the NEWT service. It also gives you a jQuery helper function that will let you interact with NEWT called $.newt_ajax(). newt.js depends on jQuery, so you will need the jQuery libraries included in your <head> section


Use $.newt_ajax() to make requests to the NEWT service. Parameters are passed in as a JSON hash. Minimally you must provide a url parameter, and in most cases you will need to provide a request type - one of GET, POST, PUT or DELETE. The response is handled via a success callback function

.

    
<script src="https://newt.nersc.gov/js/jquery-1.7.2.js"></script>
<script src="https://newt.nersc.gov/js/newt.js"></script>
<script type="text/javascript">
   
$.newt_ajax({
    url: '/',
    type: 'GET',
    success: function(response) {
        alert ("NEWT responded with" + response.text);
    }
});

</script>

         

That's it. You now have a simple application that talks to the NEWT service via $.newt_ajax, and renders the response as an alert box. Note that newt.js transparently handles authentication and session management!

 Hello World (REST)

This example assumes that you have the command line HTTP client curl. The goal of this example is to demonstrate how the REST layer of NEWT operates. A NEWT Call consists of an HTTP verb (GET/POST/PUT/DELETE), a URL and optional parameters.


Login to the NEWT service using your username and password. We will save stateful session information in a cookie file called newt_cookie.txt. The login service resides at https://newt.nersc.gov/newt/auth

    
# REST API: POST https://newt.nersc.gov/newt/auth
# Params: username=USERNAME&password=PASSWORD

curl -k -c newt_cookies.txt -X POST -d "username=USERNAME&password=PASSWORD" https://newt.nersc.gov/newt/auth
{"username": "newtuser", "auth": true}
             
    

Once you are logged in, you can access other parts of the API using your session cookies. For example, to check the status of a resource called "cori" we send a GET request to https://newt.nersc.gov/newt/status/cori

        
# REST API: GET https://newt.nersc.gov/newt/status/cori

curl -k -b newt_cookies.txt -X GET https://newt.nersc.gov/newt/status/cori
{"status": "up", "text": "", "system": "cori"}
                 
        

For more information check out the API documentation and the demos. Note that most of the examples will require a NERSC account to do anything meaningful.


 Contact

If you are a NEWT user, we want to know! Send us email at newt AT nersc.gov.

If you are interested in getting involved with the development of web APIs for HPC, or have another service similar to NEWT, please consider joining the W3C HPC Community Group. We are actively involved with this group and working to bring RESTful API standards to the HPC community.