Skip to content

Instantly share code, notes, and snippets.

@zotos
Last active April 7, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zotos/fe3ff052b443cb9bb946472da9a74f39 to your computer and use it in GitHub Desktop.
Save zotos/fe3ff052b443cb9bb946472da9a74f39 to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"title": "Lab Automated API",
"version": "1.0.0-beta"
},
"host": "lab-api.nowsecure.com",
"schemes": [
"https"
],
"basePath": "/",
"produces": [
"application/json"
],
"paths": {
"/account": {
"get": {
"summary": "View account details",
"operationId": "currentAccount",
"description": "Returns account record for current user (total assessments, account limits):\n\n```\nGET /account\nAuthentication: Bearer <token>\n```\n---\n```\n{\n \"id\": \"9ad28c2c-ee41-44d8-9de2-64060b52c534\",\n \"limits\": {\n \"assessments\": 2\n }\n}\n```\n",
"tags": [
"account"
],
"consumes": [
"application/json"
],
"security": [
{
"Bearer": []
}
],
"responses": {
"200": {
"description": "Account record associated with current user",
"schema": {
"$ref": "#/definitions/Account"
}
},
"404": {
"description": "No account for current user",
"schema": {
"$ref": "#/definitions/NotFoundError"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/account/user/": {
"get": {
"summary": "List of current users on account",
"operationId": "listUsers",
"security": [
{
"Bearer": []
}
],
"tags": [
"account"
],
"responses": {
"200": {
"description": "Account user records",
"schema": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/User"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/account/user/{id}": {
"parameters": [
{
"in": "path",
"name": "id",
"description": "User id to remove",
"required": true,
"type": "string",
"format": "uuid"
}
],
"get": {
"summary": "View a specific user profile",
"operationId": "getUser",
"security": [
{
"Bearer": []
}
],
"tags": [
"account"
],
"responses": {
"200": {
"description": "Account user record",
"schema": {
"$ref": "#/definitions/User"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"delete": {
"summary": "View a specific user profile",
"operationId": "removeUser",
"security": [
{
"Bearer": []
}
],
"tags": [
"account"
],
"responses": {
"204": {
"description": "Account removed"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/account/invite/": {
"get": {
"summary": "List of outstanding user invites for account",
"operationId": "listInvites",
"security": [
{
"Bearer": []
}
],
"tags": [
"account"
],
"responses": {
"200": {
"description": "Oustanding invites",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Invite"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"summary": "Invite a new user to join your account",
"operationId": "createInvite",
"security": [
{
"Bearer": []
}
],
"tags": [
"account"
],
"consumes": [
"application/octet-stream",
"application/vnd.android.package-archive"
],
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"type": "object",
"properties": {
"email": {
"$ref": "#/definitions/User/properties/email"
},
"name": {
"$ref": "#/definitions/User/properties/name"
}
}
}
}
],
"responses": {
"201": {
"description": "Invite sent",
"headers": {
"Location": {
"description": "Location of invite resource",
"type": "string",
"format": "uri"
}
},
"schema": {
"$ref": "#/definitions/Invite"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/build/": {
"post": {
"summary": "Submit a new build for assessment",
"operationId": "submitBuild",
"security": [
{
"Bearer": []
}
],
"description": "Extracts application metadata from an uploaded binary, creating an application resource if necessary, and triggers an assessment of this build using the platform-default analysis config.\n\nTo POST a new app binary:\n\n```\nPOST /build/\nAuthentication: Bearer <token>\n\n<apk or ipa file>\n```\n---\n```\n{\n \"account\": \"9ad28c2c-ee41-44d8-9de2-64060b52c534\",\n \"platform\": \"android\",\n \"package\": \"com.example.App\",\n \"task\": 1459888789439,\n \"config\": {\n \"dynamic\": true,\n \"static\": {\n \"certificate_validity_check\": true,\n \"debug_flag_check\": true,\n \"keysize_check\": true,\n \"master_key_check\": true,\n \"obfuscation_check\": true,\n \"secure_random_check\": true,\n \"dynamic_code_loading_check\": true,\n \"application_overprivileged_check\": true,\n \"allow_backup_check\": true,\n \"javascript_interface_check\": true,\n \"urls_check\": true,\n \"decode_apk_check\": true,\n \"decompile_apk_check\": true,\n \"get_app_files\": true,\n \"get_native_methods\": true,\n \"get_reflection_code\": true\n }\n },\n \"binary\": \"74b79cd773b7cddec1ccb6f56d9e0972e274f1f0dc336b8cdf987fbf4a94a15f\",\n \"creator\": \"81e3b350-0325-457e-8d32-f7202ce8a2a8\",\n \"created\": \"2016-04-05T20:39:49.684Z\",\n \"updated\": \"2016-04-05T20:39:49.608Z\"\n}\n\n```\n",
"tags": [
"applications",
"analysis"
],
"consumes": [
"application/octet-stream",
"application/vnd.android.package-archive"
],
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"description": "Build blob (e.g. apk or ipa file)",
"schema": {
"type": "string",
"format": "byte"
}
}
],
"responses": {
"201": {
"description": "Initialized assessment",
"headers": {
"Location": {
"description": "Location of initialized assessment resource",
"type": "string",
"format": "uri"
}
},
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/App"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/app/": {
"get": {
"summary": "List all applications associated with account",
"operationId": "listApps",
"security": [
{
"Bearer": []
}
],
"tags": [
"applications"
],
"description": "List all applications associated with account:\n\n```\nGET /app/\nAuthentication: Bearer <token>\n```\n---\n```\n[\n {\n \"account\": \"9ad28c2c-ee41-44d8-9de2-64060b52c534\",\n \"platform\": \"android\",\n \"package\": \"com.example.App\",\n \"binary\": \"74b79cd773b7cddec1ccb6f56d9e0972e274f1f0dc336b8cdf987fbf4a94a15f\"\n }\n]\n\n```\n",
"responses": {
"200": {
"description": "Application records",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/App"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"summary": "Create application resource",
"description": "This is just a top level container. No assessments can be run on this application until a build binary is associated.\n\nTo create and configure an app resource without providing the underlying binary:\n\n```\nPOST /app/\nAuthentication: Bearer <token>\n\n{\n \"platform\": \"android\",\n \"package\": \"com.example.App2\"\n}\n```\n---\n```\n{\n \"platform\": \"android\",\n \"package\": \"com.test.App2\",\n \"account\": \"9ad28c2c-ee41-44d8-9de2-64060b52c534\",\n \"created\": \"2016-04-05T20:47:17.490Z\"\n}\n\n```\n",
"operationId": "createApp",
"security": [
{
"Bearer": []
}
],
"tags": [
"applications"
],
"responses": {
"201": {
"description": "Created application",
"headers": {
"Location": {
"description": "Location of invite resource",
"type": "string",
"format": "uri"
}
},
"schema": {
"$ref": "#/definitions/App"
}
},
"409": {
"description": "Application already exists",
"schema": {
"$ref": "#/definitions/ConflictError"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"subscribe": {
"summary": "Observe all changes to app summary record",
"description": "This endpoint will return the current state, then remain open, emitting all changes occurring to app records.\n\nTo observe all app updates on a given account:\n\n```\nSUBSCRIBE /app/\nAuthentication: Bearer <token>\n```\n---\n```\n[\n ... stream of app records and changes\n",
"operationId": "observeAssessments",
"security": [
{
"Bearer": []
}
],
"tags": [
"analysis"
],
"responses": {
"200": {
"description": "Assessment observer",
"schema": {
"properties": {
"value": {
"$ref": "#/definitions/Assessment"
}
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/app/{platform}/{package}": {
"parameters": [
{
"in": "path",
"name": "platform",
"description": "Target platform key",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "package",
"description": "Target package id",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Get application details",
"operationId": "getApp",
"security": [
{
"Bearer": []
}
],
"tags": [
"applications"
],
"description": "To get app details:\n\n```\nGET /app/android/com.example.App\nAuthorization: Bearer <token>\n```\n---\n```\n{\n \"account\": \"9ad28c2c-ee41-44d8-9de2-64060b52c534\",\n \"platform\": \"android\",\n \"package\": \"fuzion24.dynamictestapp\",\n \"binary\": \"74b79cd773b7cddec1ccb6f56d9e0972e274f1f0dc336b8cdf987fbf4a94a15f\"\n}\n```\n",
"responses": {
"200": {
"description": "Application record",
"schema": {
"$ref": "#/definitions/App"
}
},
"404": {
"description": "Not found",
"schema": {
"$ref": "#/definitions/NotFoundError"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/app/{platform}/{package}/config": {
"parameters": [
{
"in": "path",
"name": "platform",
"description": "Target platform key",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "package",
"description": "Target package id",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Get application config overrides",
"description": "This endpoint will calculate and return the complete analysis configuration which will be submitted with analysis jobs, including any overrides explicitly set for the app.\n",
"operationId": "getAppConfig",
"security": [
{
"Bearer": []
}
],
"tags": [
"applications",
"analysis"
],
"responses": {
"200": {
"description": "Complete analysis config record",
"schema": {
"$ref": "#/definitions/AnalysisConfig"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"summary": "Set analysis config overrides for application entity",
"operationId": "updateAppConfig",
"security": [
{
"Bearer": []
}
],
"tags": [
"applications",
"analysis"
],
"consumes": [
"application/octet-stream",
"application/vnd.android.package-archive"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Config overrides",
"required": true,
"schema": {
"$ref": "#/definitions/AnalysisConfig"
}
}
],
"responses": {
"200": {
"description": "Complete analysis config record",
"schema": {
"$ref": "#/definitions/AnalysisConfig"
}
},
"404": {
"description": "Not found",
"schema": {
"$ref": "#/definitions/NotFoundError"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/app/{platform}/{package}/assessment/": {
"parameters": [
{
"in": "path",
"name": "platform",
"description": "Target platform key",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "package",
"description": "Target package id",
"required": true,
"type": "string"
}
],
"post": {
"summary": "Trigger application assessment",
"description": "This endpoint will trigger an assessment on the app entity using the current associated build and analysis config.\n",
"operationId": "triggerAppAssessment",
"security": [
{
"Bearer": []
}
],
"tags": [
"analysis"
],
"responses": {
"201": {
"description": "Initialized assessment",
"headers": {
"Location": {
"description": "Location of initialized assessment resource",
"type": "string",
"format": "uri"
}
},
"schema": {
"$ref": "#/definitions/Assessment"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"get": {
"summary": "List application assessments",
"description": "This endpoint will trigger an assessment on the app entity using the current associated build and analysis config.\n\n```\nGET /app/android/com.example.App/asessment/\nAuthentication: Bearer <token>\n```\n---\n```\n[\n {\n \"account\": \"9ad28c2c-ee41-44d8-9de2-64060b52c534\",\n \"platform\": \"android\",\n \"package\": \"com.example.App\",\n \"task\": 1459448277087,\n \"config\": {\n \"dynamic\": true,\n \"static\": {\n \"certificate_validity_check\": true,\n \"debug_flag_check\": true,\n \"keysize_check\": true,\n \"master_key_check\": true,\n \"obfuscation_check\": true,\n \"secure_random_check\": true,\n \"dynamic_code_loading_check\": true,\n \"application_overprivileged_check\": true,\n \"allow_backup_check\": true,\n \"javascript_interface_check\": true,\n \"urls_check\": true,\n \"decode_apk_check\": true,\n \"decompile_apk_check\": true,\n \"get_app_files\": true,\n \"get_native_methods\": true,\n \"get_reflection_code\": true\n }\n },\n \"binary\": \"74b79cd773b7cddec1ccb6f56d9e0972e274f1f0dc336b8cdf987fbf4a94a15f\",\n \"creator\": \"bdc8852d-a1b4-4dc1-83ae-d747b27bc050\",\n },\n ...\n]\n```\n",
"operationId": "listAppAssessments",
"security": [
{
"Bearer": []
}
],
"tags": [
"analysis"
],
"parameters": [
{
"in": "path",
"name": "platform",
"description": "Target platform key",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "package",
"description": "Target package id",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Created assessment",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Assessment"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/platform/{package}/config": {
"parameters": [
{
"in": "path",
"name": "platform",
"description": "Target platform key",
"required": true,
"type": "string"
}
],
"get": {
"summary": "Get platform analysis config defaults",
"description": "This endpoint will calculate and return the default analysis config for a given platform.\n",
"operationId": "getPlatformConfig",
"security": [
{
"Bearer": []
}
],
"tags": [
"analysis"
],
"responses": {
"200": {
"description": "Platform-default analysis config record",
"schema": {
"$ref": "#/definitions/AnalysisConfig"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/assessment/": {
"subscribe": {
"summary": "Observe all assessment updates",
"description": "To observe all assessment updates on a given account.\n",
"operationId": "observeAssessments",
"security": [
{
"Bearer": []
}
],
"tags": [
"analysis"
],
"responses": {
"200": {
"description": "Assessment observer",
"schema": {
"properties": {
"value": {
"$ref": "#/definitions/Assessment"
}
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"securityDefinitions": {
"Bearer": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"description": "Bearer <token>"
}
},
"definitions": {
"Account": {
"description": "Account resource, may be associated with multiple Users.\n",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"description": "Account identifier\n",
"type": "string",
"format": "uuid"
},
"name": {
"description": "Optional string label for account/team.\n",
"type": "string"
},
"counts": {
"type": "object",
"properties": {
"assessments": {
"description": "Total number of assessments which are scheduled or have completed successful.\n",
"type": "integer"
}
}
},
"limits": {
"type": "object",
"properties": {
"assessments": {
"description": "Total number of assessments which can be run on account.\n",
"type": "number"
}
}
}
}
},
"User": {
"description": "User resource",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"description": "User identifier",
"type": "string",
"format": "uuid"
},
"account": {
"$ref": "#/definitions/Account/properties/id"
},
"email": {
"description": "User email",
"type": "string",
"format": "email"
},
"name": {
"description": "Display name for user",
"type": "string"
}
}
},
"Platform": {
"description": "Resource representing valid analysis platforms",
"type": "object",
"properties": {
"key": {
"description": "Platform identifier",
"enum": [
"ios",
"android"
]
}
}
},
"App": {
"description": "Resource representing unique package per platform per account.\n",
"type": "object",
"required": [
"account",
"platform",
"package"
],
"properties": {
"account": {
"$ref": "#/definitions/Account/properties/id"
},
"platform": {
"$ref": "#/definitions/Platform/properties/key"
},
"package": {
"description": "Application package identifier, typically in reverse-DNS notation.\n",
"type": "string"
},
"binary": {
"type": "string",
"format": "sha256-hex",
"description": "Reference to the latest build resource representing current app binary.\n"
},
"name": {
"type": "string",
"description": "User-defined display name override for app.\n\nIf not provided, the display name of the latest binary will be used.\n"
},
"creator": {
"$ref": "#/definitions/User/properties/id"
},
"created": {
"type": "string",
"format": "date-time",
"description": "Time of app creation\n"
}
}
},
"Assessment": {
"description": "Associates an app assessment task to related analysis jobs.\n",
"type": "object",
"required": [
"account",
"platform",
"package",
"task",
"config",
"status",
"binary",
"creator",
"created"
],
"properties": {
"account": {
"$ref": "#/definitions/Account/properties/id"
},
"platform": {
"$ref": "#/definitions/Platform/properties/key"
},
"package": {
"$ref": "#/definitions/App/properties/package"
},
"task": {
"description": "Idenifier associating multiple analysis jobs with assessment record.\n",
"type": "number"
},
"config": {
"type": "string"
},
"status": {
"description": "Analysis queue status of associated jobs.\n",
"type": "object"
},
"binary": {
"type": "string",
"format": "sha256-hex",
"description": "Reference to the build resource used for assessment.\n"
},
"creator": {
"description": "User id responsible for creating task\n",
"type": "string"
},
"created": {
"description": "Time of task creation\n",
"type": "string",
"format": "date-time"
},
"updated": {
"description": "Time of most recent analysis job update\n",
"type": "string",
"format": "date-time"
},
"counts": {
"properties": {
"ended": {
"description": "How many jobs are in a terminal state\n",
"type": "integer"
},
"failed": {
"description": "How many jobs ended in an error state\n",
"type": "integer"
},
"processing": {
"description": "How many jobs are currently processing\n",
"type": "integer"
},
"total": {
"description": "How many total jobs are currently queued\n",
"type": "integer"
}
}
}
}
},
"Build": {
"description": "Parsed application build metadata, keyed by hash digest of binary.\n",
"type": "object",
"required": [
"account",
"platform",
"package",
"digest",
"uploader",
"uploaded"
],
"properties": {
"account": {
"$ref": "#/definitions/Account/properties/id"
},
"platform": {
"$ref": "#/definitions/Platform/properties/key"
},
"package": {
"$ref": "#/definitions/App/properties/package"
},
"digest": {
"description": "SHA-256 hash digest of build binary.\n",
"type": "string",
"format": "sha256-hex"
},
"analyzed": {
"description": "Whether metadata extractin job has completed\n",
"type": "boolean"
},
"name": {
"description": "Package or bundle name\n",
"type": "string"
},
"title": {
"description": "Display name\n",
"type": "string"
},
"version": {
"description": "Build version string, e.g. \"1.0\", \"2855543\", \"4.3.2.2000\"\n",
"type": "string"
},
"icon": {
"description": "Build icon as base64 data url\n",
"type": "string"
},
"uploader": {
"$ref": "#/definitions/User/properties/id"
},
"uploaded": {
"description": "Time of first upload on account\n",
"type": "string",
"format": "date-time"
}
}
},
"Invite": {
"description": "Resource for manages invites for users on account\n",
"type": "object",
"properties": {
"id": {
"description": "Invite identifier\n",
"type": "string",
"format": "uuid"
},
"account": {
"description": "Account the new user will be associated with\n",
"type": "string"
},
"email": {
"description": "Email to send the invite to\n",
"type": "string",
"format": "email"
},
"name": {
"description": "Optional name for invitee suggested by sender\n",
"type": "string"
},
"from": {
"description": "User id of account user who sent the invite\n",
"type": "string"
},
"created": {
"description": "Timestamp of invite creation\n",
"type": "string"
},
"sent": {
"type": "string",
"format": "date-time"
},
"acknowledged": {
"description": "Timestamp for invite acknowledgement\n",
"type": "string",
"format": "date-time"
},
"user": {
"description": "If accepted this is the resulting id of user who accepted\n",
"type": "string"
}
}
},
"AnalysisConfig": {
"description": "Analysis configuration object",
"type": "object",
"properties": {
"static": {
"type": [
"object",
"boolean"
]
},
"dynamic": {
"type": [
"object",
"boolean"
]
}
}
},
"Error": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"message": {
"type": "string"
},
"status": {
"type": "integer",
"format": "int32"
}
}
},
"NotFoundError": {
"type": "object",
"properties": {
"$ref": "#/definitions/Error/properties"
}
},
"ConflictError": {
"type": "object",
"properties": {
"$ref": "#/definitions/Error/properties"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment