======== Apps API ======== .. include:: ../../complete.rst The Apps endpoints provide a way to view and update application details Get an App List --------------- .. http:get:: /api/v1/jb/apps/ Get a list of Apps **Example Request**: .. code:: GET /api/v1/jb/apps/ Accept: application/json Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665 **Example Response**: .. code:: HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript [ { "id": "zylTKNVx", "slug": "datademo", "label": "Data Services Demo", "usage": {}, "package_info": {}, "show_help": false, "help_html": "\n", "show_footer": false, "footer_html": "", "description": "US Census Bureau data services demo", "in_maintenance": false, "maintenance_message": "Currently offline, please try again in a few minutes." } ] :>json string id: the unique id of the application :>json string slug: a shortened name of the application :>json string label: The label or name of the application :>json string description: A short description of the app :>json object usage: Usage details for this app for 30,60,90 day windows :>json object package_info: Details on the development version of this app. :>json string help_html: HTML to append to the built in help :>json string footer_html: HTML to show as the app footer :>json boolean show_help: should we show help in the app :>json boolean show_footer: should we show a footer in the app :>json boolean in_maintenance: should the app display a maintenance message :>json string maintenance_message: the message to display if the app is in maintenance :reqheader Accept: the response content type depends on ``Accept`` header :reqheader Authorization: contains the token to be used for authentication :resheader Content-Type: this depends on ``Accept`` header of request :statuscode 200: OK :statuscode 403: Authentication Failed Get an App's Details -------------------- .. http:get:: /api/v1/jb/apps/(string:app_id)/ Get an App's Details **Example Request**: .. code:: GET /api/v1/jb/apps/zylTKNVx/ Accept: application/json Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665 **Example Response**: .. code:: HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "id": "zylTKNVx", "slug": "datademo", "label": "Data Services Demo", "usage": {}, "package_info": {}, "show_help": false, "help_html": "\n", "show_footer": false, "footer_html": "", "description": "US Census Bureau data services demo", "in_maintenance": false, "maintenance_message": "Currently offline, please try again in a few minutes." } :param string id: the unique id of the application :>json string id: the unique id of the application :>json string slug: a shortened name of the application :>json string label: The label or name of the application :>json string description: A short description of the app :>json object usage: Usage details for this app for 30,60,90 day windows :>json object package_info: Details on the development version of this app. :>json string help_html: HTML to append to the built in help :>json string footer_html: HTML to show as the app footer :>json boolean show_help: should we show help in the app :>json boolean show_footer: should we show a footer in the app :>json boolean in_maintenance: should the app display a maintenance message :>json string maintenance_message: the message to display if the app is in maintenance :reqheader Accept: the response content type depends on ``Accept`` header :reqheader Authorization: contains the token to be used for authentication :resheader Content-Type: this depends on ``Accept`` header of request :statuscode 200: OK :statuscode 403: Authentication Failed :statuscode 404: App Not Found Update an App's Details ----------------------- .. http:patch:: /api/v1/jb/apps/(string:app_id)/ Change an applications label, description, help or footer html, and control help or footer display status. **Example Request**: .. code:: PATCH /api/v1/jb/apps/zylTKNVx/ Accept: application/json Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665 { "show_help": true } **Example Response**: .. code:: HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript { "id": "zylTKNVx", "slug": "datademo", "label": "Data Services Demo", "usage": {}, "package_info": {}, "show_help": false, "help_html": "\n", "show_footer": false, "footer_html": "", "description": "US Census Bureau data services demo", "in_maintenance": false, "maintenance_message": "Currently offline, please try again in a few minutes." } :param string id: the unique id of the application :json string id: the unique id of the application :>json string slug: a shortened name of the application :>json string label: The label or name of the application :>json string description: A short description of the app :>json object usage: Usage details for this app for 30,60,90 day windows :>json object package_info: Details on the development version of this app. :>json string help_html: HTML to append to the built in help :>json string footer_html: HTML to show as the app footer :>json boolean show_help: should we show help in the app :>json boolean show_footer: should we show a footer in the app :>json boolean in_maintenance: should the app display a maintenance message :>json string maintenance_message: the message to display if the app is in maintenance :reqheader Accept: the response content type depends on ``Accept`` header :reqheader Authorization: contains the token to be used for authentication :resheader Content-Type: this depends on ``Accept`` header of request :statuscode 200: OK :statuscode 403: Authentication Failed :statuscode 404: App Not Found Clear an App's SQL Cache ------------------------ .. http:delete:: /api/v1/jb/apps/(string:app_id)/clear_cache/ Delete an application's recipe cache which will removed any stored responses from SQL queries. **Example Request**: .. code:: DELETE /api/v1/jb/apps/zylTKNVx/clear_cache/ Accept: application/json Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665 **Example Response**: .. code:: HTTP/1.1 204 NO CONTENT Vary: Accept Content-Type: text/javascript :reqheader Accept: the response content type depends on ``Accept`` header :reqheader Authorization: contains the token to be used for authentication :resheader Content-Type: this depends on ``Accept`` header of request :statuscode 204: Cache cleared :statuscode 500: Could not clear cache Get an App's Usage Logs ----------------------- .. http:get:: /api/v1/jb/apps/(string:app_id)/usage/?window=(int:days) Get an App's Usage Logs. If no time window is specified, logs for the last 30 days are returned. **Example Request**: .. code:: GET /api/v1/jb/apps/zylTKNVx/usage/ Accept: application/json Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665 **Example Response**: .. code:: HTTP/1.1 200 OK Vary: Accept Content-Type: text/javascript [ { "action_description": "Viewed Census stack for Juicebox 3 Demo", "email": "chris@juice.com", "full_name": "Christian Oliver", "timestamp": "2018-01-22T20:25:04.948059Z", "action": "STACK_ACCESS", "extra": { "app": "Juicebox 3 Demo", "request": { "path": "/jb3demo/census", "session": "obpswmqw16wd33va7t0onvub78m8svcq", "META": { "HTTP_USER_AGENT": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36", "SERVER_NAME": "1.0.0.127.in-addr.arpa", "HTTP_REFERER": "Not found", "REMOTE_ADDR": "127.0.0.1", "CONTENT_TYPE": "text/plain", "REQUEST_METHOD": "GET", "HTTP_HOST": "localhost:8000", "SERVER_PORT": "8000", "QUERY_STRING": "", "HTTP_ACCEPT_ENCODING": "gzip, deflate, br" } }, "stack": "Census", "app_id": "xVNKTlyz" } } ] :param string id: the unique id of the application :param int window: time window through which the logs should be returned. Defaults to 30 days (optional) :>json string action_description: a description of the action performed :>json string email: the email of the user that performed the action :>json string full_name: the full name of the user that performed the action :>json string timestamp: the timestamp at which the action was performed :>json string action: the type of action that was performed :>json object extra: extra data associated with the action :reqheader Accept: the response content type depends on ``Accept`` header :reqheader Authorization: contains the token to be used for authentication :resheader Content-Type: this depends on ``Accept`` header of request :statuscode 200: OK :statuscode 403: Authentication Failed :statuscode 404: App Not Found