Skip to content

REST API

Youngchan Kim edited this page Oct 10, 2016 · 25 revisions

DrawML WAS-flask REST API

URI(default) Method Description Content-Type
/ GET redirect to index
/index GET initial page
/auth/signin GET signin page
/auth/signout GET signout
/auth/register GET register
/experiments/ GET show all user's exp
/experiments/<exp_id> GET show specific exp
/experiments/api/<exp_id> GET get specific exp application/json
/experiments/ POST create exp application/json
/experiments/<exp_id> PATCH update exp application/json
/experiments/<exp_id> DELETE delete exp
/experiments/<exp_id>run POST run exp application/xml
/experiments/<exp_id>stop DELETE stop exp
/experiments/<exp_id>status GET get experiement status application/json
/experiments/<exp_id>clear DELETE clear experiement status cache
/data/upload GET show upload form multipart
/data/ POST upload new file application/json
/data/ GET show all data files
/data/<data_id> GET show specific data file
/data/api GET get all user's data files application/json
/data/api/<data_id> GET get specific data file application/json
/data/<data_id> PATCH update data(name) application/json
/data/<data_id> DELETE delete data
/tests/ GET show all user's trained model
/tests/<trainedmodel_id> GET show specific trained model
/tests/<trainedmodel_id>/update POST update trained model application/json
/tests/<trainedmodel_id>/<model_id> POST run trained model with data application/json
/tests/<trainedmodel_id> DELETE delete test
/tests/<trainedmodel_id>stop DELETE stop test
/tests/<trainedmodel_id>status GET get trained model status application/json
/tests/<trainedmodel_id>clear DELETE clear trained model status cache application/json
/log/ GET show all user's trained model
/log/<data_id> GET show specific trained model
/log/<data_id>/update POST update trained model application/json
/log/<data_id> DELETE delete log

/experiments/ (POST, create)

Params(default) :
{
  "exp_data":{
    "name": "myexp",
    "drawing":"febric...",
    "xml": "<experiment>..</experiment>",
    "input": 2048
  }
}
Return value :
Description :

/experiments/exp_id (DELETE)

Params(default) : none
Return value :
Description :

/experiments/exp_id (PATCH, update)

Params(default) :
{
  "exp_data":{
    "name": "myexp_after",
    "drawing":"febric..",
    "xml": "<experiment>..</experiment>",
    "input": 2048
  }
}
Return value :
Description :

/experiments/run (POST)

Params(default) :
<experiment>
    <input>

    </input>
    <model>
        <type>logistic_regression</type>
        <initializer>
            <type>random_uniform</type> <!-- valid type -->
            <min>-1.0</min>     <!-- float -->
            <max>1.0</max>    <!-- float -->
        </initializer>
        <optimizer>
            <type>gradient_descent</type>           <!-- valid type -->
            <learning_rate>0.01</learning_rate>     <!-- float -->
        </optimizer>
        <regularization>
            <enable>true</enable>
            <lambda>0.0</lambda>
        </regularization>
        <training_epoch>1024</training_epoch>     <!-- unsigned -->
    </model>
</experiment>
Return value :
Description :

/data/api (GET)

Params(default) :
{
  [
    { 
      "user_id": 1, 
      "name": "file2", 
      "path": "file_path", 
      "date_modified": "2016-09-18 00:48:34", 
      "date_created": "2016-09-18 00:45:38", 
      "id": 7
    },
    { 
      "user_id": 1, 
      "name": "file3", 
      "path": "file_path", 
      "date_modified": "2016-09-18 00:48:34", 
      "date_created": "2016-09-18 00:45:38", 
      "id": 8
    }
  ]
}

/data/api/<data_id> (GET)

Params(default) :
{ 
      "user_id": 1, 
      "name": "file3", 
      "path": "file_path", 
      "date_modified": "2016-09-18 00:48:34", 
      "date_created": "2016-09-18 00:45:38", 
      "id": 8
}

/data/<data_id> (PATCH)

Params(default) :
{
  "data":{
    "name": "file_name",
  }
}

Reference http://blog.mwaysolutions.com/2014/06/05/10-best-practices-for-better-restful-api/