External Applications

External appliations allows you to associate an internal account with an external application, and insert datasets that are then associated with external users.

This is a one to one relationship. Each account can only be associated with a single external application.
You must associate the account with an app before creating external users with that account.

  • POST /createexternalapp Tie existing internal VWP account to new external application.

    Request Payload

    
        {'application':'virtualwatershed.org'}
                                

    Example post using Python

    
    #!/usr/bin/python
    
    import json
    import requests
    #PAYLOAD
    payload = {'application':'virtualwatershed.org'}
    
    #URLS
    LOGIN_URL = 'https://vwp-dev.unm.edu/apilogin'
    TIE_ACCOUNT_TO_USER_URL = 'https://vwp-dev.unm.edu/createexternalapp'
    
    #LOGIN
    s = requests.Session()
    s.auth = ('vwadmin@edac.unm.edu', 'notarealpassword')
    s.verify = False
    l = s.get(LOGIN_URL)
    
    #POST THE PAYLOAD
    result = s.post(TIE_ACCOUNT_TO_USER_URL, data=json.dumps(payload))
    if result.status_code != 200:
       print '\t', result.content
    else:
       print result.content
    
                                

    Expected response

    
    vwadmin@edac.unm.edu now tied to virtualwatershed.org
                                

POST /createexternaluser Create external user for the external app the posting user is tied to.

Request Payload


{'userid': '3ebde0ea-3ccc-11e7-afca-1379018a5da1'}
  

Example post using Python


    #!/usr/bin/python

    import json
    import requests
    #PAYLOAD

    payload = {'userid': '3ebde0ea-3ccc-11e7-afca-1379018a5da1'}

    #URLS
    LOGIN_URL = 'https://vwp-dev.unm.edu/apilogin'
    CREATE_EXTERNAL_USER_URL = 'https://vwp-dev.unm.edu/createexternaluser'

    #LOGIN
    s = requests.Session()
    s.auth = ('vwadmin@edac.unm.edu', 'notarealpassword')
    s.verify = False
    l = s.get(LOGIN_URL)

    #POST THE PAYLOAD
    result = s.post(CREATE_EXTERNAL_USER_URL, data=json.dumps(payload))
    if result.status_code != 200:
       print '\t', result.content
    else:
       print result.content
  

Expected response


User ID created: 3ebde0ea-3ccc-11e7-afca-1379018a5da1
                            

GET /showexternalusers Show a list of users the logged in user is associated with.

Example response

            {

                "app": "virtualwatershed.org",
                "userids": [
                    "3ebde0ea-3ccc-11e7-afca-1379018a5da5",
                    "e8b587a4-3cce-11e7-b2a0-577eb1672391",
                    "e12d9bc4-3ccf-11e7-b95a-0337d5e67008"
                ]

            }
          

Query Parameters
Parameter Description Type Options Required
userid Returns True if user exists or False if user does not exist. UUID F



           {
             ...
               "formats": ["zip"],
               "description": "Incline_Creek_WatershedBnds_Soilmu",
               "externaluserid": "91496f1b-b727-4d10-a475-fdb0d0b09e3f",
               "parent_model_run_uuid": "8ad6769d-b0af-4a75-87ad-cacdc77f9d61",
               "apps": ["vwp"]
            ...
           }
         
For more info on inserting data see Upload Dataset Information

GET /apps/{app}/search/{datatype}.{ext} Relevant search parameters

Query Parameters
Parameter Description Type Options Required
externalapp limit search to only the datasets that are assoiated with external app. string F
externaluserid limit search to only the datasets that are assoiated with external userid. UUID F
For more info on searching see Search