New REST API format


New REST API format

After much feedback and iteration, this is a restructured API. Docs
will be updated with API details in a later commit. I also dropped the
flask restful marshaler, it is too simple for our format. We now use
python's json serializaer + a custom SQLAlchemy object visitor.


cmatthewsJun 28 2017, 1:45 PM
rL306595: Some initial docs for the REST API

Event Timeline

Hi Chris, this commit causes servers running from the wsgi script to fail. To reproduce:

lnt create /tmp/test

wsgi Script prints:

Started file logging.
Logging to : lnt.log
 * Running on HOSTNAME:8000/ (Press CTRL+C to quit)

Visit HOSTNAME:8000 in a browser, browser displays: Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Detailed error message: - - [11/Jul/2017 16:42:49] "GET / HTTP/1.1" 500 -
Error on request:
Traceback (most recent call last):
  File ".../lib/python2.7/site-packages/werkzeug/serving.py", line 205, in run_wsgi
  File ".../lib/python2.7/site-packages/werkzeug/serving.py", line 193, in execute
    application_iter = app(environ, start_response)
  File ".../lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/data/work/lnt2017/git/lnt/lnt/server/ui/app.py", line 44, in __call__
    return self.app(environ, start_response)
  File ".../lib/python2.7/site-packages/flask/app.py", line 1813, in wsgi_app
  File ".../lib/python2.7/site-packages/flask/ctx.py", line 321, in push
    self.session = self.app.open_session(self.request)
  File ".../lib/python2.7/site-packages/flask/app.py", line 825, in open_session
    return self.session_interface.open_session(self, request)
  File ".../lib/python2.7/site-packages/flask/sessions.py", line 302, in open_session
    s = self.get_signing_serializer(app)
  File ".../lib/python2.7/site-packages/flask/sessions.py", line 299, in get_signing_serializer
  File ".../lib/python2.7/site-packages/itsdangerous.py", line 519, in __init__
    self.is_text_serializer = is_text_serializer(serializer)
  File ".../lib/python2.7/site-packages/itsdangerous.py", line 69, in is_text_serializer
    return isinstance(serializer.dumps({}), text_type)
  File ".../lib/python2.7/site-packages/flask/sessions.py", line 85, in dumps
    return json.dumps(_tag(value), separators=(',', ':'))
  File ".../lib/python2.7/site-packages/flask/json.py", line 126, in dumps
    rv = _json.dumps(obj, **kwargs)
  File ".../lib/python2.7/site-packages/simplejson/__init__.py", line 397, in dumps
TypeError: __init__() got an unexpected keyword argument 'iterable_as_array'

This happens regardless of what data has been imported to the database, and worked prior to revision 306596.