Apps API

Note

This help should be accurate and comprehensive. If you see anything missing or that needs to be fixed, see How to Contribute or let us know in the Juice Slack #documentation channel.

The Apps endpoints provide a way to view and update application details

Get an App List

GET /api/v1/jb/apps/

Get a list of Apps

Example Request:

GET /api/v1/jb/apps/
Accept: application/json
Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665

Example Response:

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."
  }
]
Response JSON Object:
 
  • id (string) – the unique id of the application
  • slug (string) – a shortened name of the application
  • label (string) – The label or name of the application
  • description (string) – A short description of the app
  • usage (object) – Usage details for this app for 30,60,90 day windows
  • package_info (object) – Details on the development version of this app.
  • help_html (string) – HTML to append to the built in help
  • footer_html (string) – HTML to show as the app footer
  • show_help (boolean) – should we show help in the app
  • show_footer (boolean) – should we show a footer in the app
  • in_maintenance (boolean) – should the app display a maintenance message
  • maintenance_message (string) – the message to display if the app is in maintenance
Request Headers:
 
  • Accept – the response content type depends on Accept header
  • Authorization – contains the token to be used for authentication
Response Headers:
 
Status Codes:

Get an App’s Details

GET /api/v1/jb/apps/(string: app_id)/

Get an App’s Details

Example Request:

GET /api/v1/jb/apps/zylTKNVx/
Accept: application/json
Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665

Example Response:

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."
}
Parameters:
  • id (string) – the unique id of the application
Response JSON Object:
 
  • id (string) – the unique id of the application
  • slug (string) – a shortened name of the application
  • label (string) – The label or name of the application
  • description (string) – A short description of the app
  • usage (object) – Usage details for this app for 30,60,90 day windows
  • package_info (object) – Details on the development version of this app.
  • help_html (string) – HTML to append to the built in help
  • footer_html (string) – HTML to show as the app footer
  • show_help (boolean) – should we show help in the app
  • show_footer (boolean) – should we show a footer in the app
  • in_maintenance (boolean) – should the app display a maintenance message
  • maintenance_message (string) – the message to display if the app is in maintenance
Request Headers:
 
  • Accept – the response content type depends on Accept header
  • Authorization – contains the token to be used for authentication
Response Headers:
 
Status Codes:

Update an App’s Details

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:

PATCH /api/v1/jb/apps/zylTKNVx/
Accept: application/json
Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665

{
  "show_help": true
}

Example Response:

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."
}
Parameters:
  • id (string) – the unique id of the application
Request JSON Object:
 
  • label (string) – The label or name of the application (optional)
  • description (string) – A short description of the app (optional)
  • help_html (string) – HTML to append to the built in help (optional)
  • footer_html (string) – HTML to show as the app footer (optional)
  • show_help (boolean) – should we show help in the app (optional)
  • show_footer (boolean) – should we show a footer in the app (optional)
  • in_maintenance (boolean) – should the app display a maintenance message (optional)
  • maintenance_message (string) – the message to display if the app is in maintenance (optional)
Response JSON Object:
 
  • id (string) – the unique id of the application
  • slug (string) – a shortened name of the application
  • label (string) – The label or name of the application
  • description (string) – A short description of the app
  • usage (object) – Usage details for this app for 30,60,90 day windows
  • package_info (object) – Details on the development version of this app.
  • help_html (string) – HTML to append to the built in help
  • footer_html (string) – HTML to show as the app footer
  • show_help (boolean) – should we show help in the app
  • show_footer (boolean) – should we show a footer in the app
  • in_maintenance (boolean) – should the app display a maintenance message
  • maintenance_message (string) – the message to display if the app is in maintenance
Request Headers:
 
  • Accept – the response content type depends on Accept header
  • Authorization – contains the token to be used for authentication
Response Headers:
 
Status Codes:

Get an App’s Usage Logs

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:

GET /api/v1/jb/apps/zylTKNVx/usage/
Accept: application/json
Authorization: Token 7297b3ebb0e7f7baf5f54d39908dda99f5ea8665

Example Response:

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"
    }
  }
]
Parameters:
  • id (string) – the unique id of the application
  • window (int) – time window through which the logs should be returned. Defaults to 30 days (optional)
Response JSON Object:
 
  • action_description (string) – a description of the action performed
  • email (string) – the email of the user that performed the action
  • full_name (string) – the full name of the user that performed the action
  • timestamp (string) – the timestamp at which the action was performed
  • action (string) – the type of action that was performed
  • extra (object) – extra data associated with the action
Request Headers:
 
  • Accept – the response content type depends on Accept header
  • Authorization – contains the token to be used for authentication
Response Headers:
 
Status Codes: