The Beagle Security API allows developers to work with Projects, Applications and run tests in a more customizable manner. The v2 APIs are engineered to be flexible and intuitive to help your team get the most out of the Beagle Security platform.
All Beagle Security APIs are built using REST conventions and use standard HTTP features. The Beagle Security API calls are made under https://api.beaglesecurity.com and all responses return standard JSON.
It passes the access token as the bearer token in the authorization header. The access token can be generated from your Beagle Security account. Go to Profile --> Personal access token and click on the “New personal access token” button. You can refer to this help article for the detailed steps.
While generating an access token, remember to include all the relevant Scope for the particular token. Make sure to keep the token safe as it cannot be viewed later.
curl --location --request POST \
'https://api.beaglesecurity.com/rest/v2/projects' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Default project",
"description": "This is a default project."
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// create a project
String projectName = "Default project";
String description = "This is a default project";
Project project = client.createProject(projectName, description);
{
"name": "Default project",
"description": "This is a default project.",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "INVALID_SESSION",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request PUT \
'https://api.beaglesecurity.com/rest/v2/projects' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Default project",
"description": "This is a default project."
}'
This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Modify a project
UUID projectKey = UUID.fromString("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
String projectName = "Default project";
String description = "This is a default project.";
Project project = client.modifyProject(projectKey, projectName, description);
{
"name": "Default project",
"description": "This is a default project.",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "INVALID_PROJECT_KEY",
"message": "Given project key is not valid."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request DELETE \
'https://api.beaglesecurity.com/rest/v2/projects?project_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Delete a project
UUID projectKey = UUID.fromString("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
Project project = client.deleteProject(projectKey);
{
"name": "Default project",
"description": "This is a default project.",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "INVALID_SESSION",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request POST \
'https://api.beaglesecurity.com/rest/v2/projects?teamId=xxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Default project",
"description": "This is a default project."
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// create a project
String projectName = "Default project";
String description = "This is a default project";
String teamId = "xxxxxxxxxx";
Project verifyStstus = client.createProject(projectName, description, teamId);
{
"name": "Default project",
"description": "This is a default project.",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "INVALID_SESSION",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/projects' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Gets all the projects and its applications under a user
List<ProjectWithApplication> projects = client.getAllProjects();
{
"code": "SUCCESS",
"message": "Success",
"projects": [
{
"name": "Default project",
"description": "New project",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "Default application",
"url": "http://196.168.0.7:80",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"applicationType": "API",
"signatureStatus": "Verified",
"hostingType": "internal"
},
{
"name": "Default application 2",
"url": "http://example.com",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"applicationType": "WEB",
"signatureStatus": "NotVerified",
"hostingType": "public"
},
]
},
{
"name": "Default project 2",
"description": "New project",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "Default application 3",
"url": "http://example2.com",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"applicationType": "WEB",
"signatureStatus": "Verified",
"hostingType": "public"
}
]
}
]
}
{
"code": "FAILED",
"message": "Failed to get projects."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/projects?include_team=true' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Gets all the projects and its applications (with team)
ProjectWithTeam projects = client.getAllProjectWithTeams();
{
"myProjects":[
{
"name": "My project 1",
"description": "New project 1",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "Test",
"url": "http://196.168.0.7:80",
"applicationToken": "3frv64jxnaa89okc20jfyys1n8dwhgnx",
"applicationType": "WEB",
"signatureStatus": "Verified",
"hostingType": "internal"
},
{
"name": "Example 1",
"url": "http://example.com",
"applicationToken": "loa3qt7wpe21gtrwqf9joseikl9taf0y",
"applicationType": "WEB",
"signatureStatus": "NotVerified",
"hostingType": "public"
}
]
},
{
"name": "My project 2",
"description": "New project 2",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "Example 2",
"url": "http://example2.com",
"applicationToken": "v1nqb9zs8xy9092rsb3gtdm391cbw86d",
"applicationType": "API",
"signatureStatus": "Verified",
"hostingType": "public"
}
]
}
],
"teamProjects": [
{
"teamName": "My team",
"teamId": "xxxxxxxxxx",
"projects": [
{
"name": "Project 1",
"description": "Test project 1",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "App 1",
"url": "https://example1.com",
"applicationToken": "bn8gp2a5n91z2nzflvcu46zuegv1zf2y",
"applicationType": "API",
"signatureStatus": "NotVerified",
"hostingType": "public"
},
{
"name": "App 2",
"url": "https://example2.com",
"applicationToken": "27u2f8odvv27rfx3pi7nfduwu9uey2gw",
"applicationType": "WEB",
"signatureStatus": "NotVerified",
"hostingType": "public"
},
]
},
{
"name": "Project 2",
"description": "Test project 2",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "App 4",
"url": "https://example4.com",
"applicationToken": "c2bzdnqzlwtxer7pczakwr4ly5zas1qa",
"applicationType": "WEB",
"signatureStatus": "Verified",
"hostingType": "public"
}
]
},
{
"name": "Project 3",
"description": "Test project 3",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"applications": [
{
"name": "App 5",
"url": "http://example5.com",
"applicationToken": "l1zqu4a7b7pmynxxsfdxyupd1bglzx0k",
"applicationType": "WEB",
"signatureStatus": "NotVerified",
"hostingType": "public"
},
{
"name": "App 6",
"url": "https://example6.com",
"applicationToken": "2epytana9nwrdnqmmi0f90kgox09tb8r",
"applicationType": "API",
"signatureStatus": "Verified",
"hostingType": "public"
}
]
}
]
}
],
"code":"SUCCESS",
"message":"Success."
}
{
"code": "FAILED",
"message": "Failed to get projects."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request POST \
'https://api.beaglesecurity.com/rest/v2/applications' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Default application",
"url": "https://example.com",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "WEB"
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Create application
String applicationName = "Default application";
String url = "https://example.com";
UUID projectKey = UUID.fromString("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
ApplicationType applicationType = ApplicationType.WEB;
Application application = client.createApplication(applicationName, url, projectKey, applicationType);
{
"name": "Default application",
"url": "https://example.com",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"signatureStatus": "NotVerified",
"hostingType": "WEB",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "URL_ALREADY_ADDED",
"message": "Given url is already added as an application."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/applications?application_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get application
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
Application application = client.getApplication(applicationToken);
{
"code": "SUCCESS",
"message": "Success",
"application": {
"name": "Test",
"url": "http://196.168.0.7:80",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"applicationType": "WEB",
"signatureStatus": "Verified",
"hostingType": "internal"
}
}
{
"code": "INVALID_APPLICATION_TOKEN",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request PUT \
'https://api.beaglesecurity.com/rest/v2/applications' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Default app",
"url": "https://example.com",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Modify application
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String applicationName = "Default app";
String url = "https://example.com";
Application application = client.modifyApplication(applicationToken, applicationName, url);
{
"name": "Default app",
"url": "https://example.com",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"signatureStatus": "Verified",
"hostingType": "API",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "FAILED",
"message": "Failed to get application(s)."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request DELETE \
'https://api.beaglesecurity.com/rest/v2/applications?application_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Delete application
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
Application application = client.deleteApplication(applicationToken);
{
"name": "Default name",
"url": "https://example.com",
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"projectKey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"signatureStatus": "Verified",
"hostingType": "API",
"code": "SUCCESS",
"message": "Success."
}
{
"code": "TEST_RUNNING",
"message": "A test for this application is running. Cannot delete."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/applications?project_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get all applications under a project
UUID projectKey = UUID.fromString("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
List<Application> application = client.getApplications(projectKey);
{
"code": "SUCCESS",
"message": "Success",
"applications": [
{
"name": "Example 1",
"url": "http://196.168.0.7:80",
"applicationToken": "3frv64jxnaa89okc20jfyys1n8dwhgnx",
"applicationType": "WEB",
"signatureStatus": "Verified",
"hostingType": "internal"
},
{
"name": "Example 2",
"url": "http://johndoe.com",
"applicationToken": "loa3qt7wpe21gtrwqf9joseikl9taf0y",
"applicationType": "WEB",
"signatureStatus": "NotVerified",
"hostingType": "public"
},
{
"name": "Example 3",
"url": "https://example.com",
"applicationToken": "qcyqpuhski5l57rfjcqwjg82mng9un1s",
"applicationType": "WEB",
"signatureStatus": "NotVerified",
"hostingType": "public"
},
{
"name": "Example 4",
"url": "https://192.168.1.1:1234",
"applicationToken": "4n49wavb2tc1bale4dt3sv6207v9rhtz",
"applicationType": "API",
"signatureStatus": "Verified",
"hostingType": "internal"
}
]
}
{
"code": "PLAN_NOT_SUPPORTED",
"message": "Your plan does not support this feature."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/applications/signature?application_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get domain verification signature
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
Signature signature = client.getSignature(applicationToken);
{
"status": "NotVerified",
"url": "https://example.com",
"code": "SUCCESS",
"message": "Success.",
"fileSignature": {
"signature": "_6r9lcxjztpnlps4sby648drxmz02zdlb"
},
"dnsSignature": {
"type": "TXT",
"name": "_31tervvaz40jy7bn543hux0hji296ovd",
"value": "_6r9lcxjztpnlps4sby648drxmz02zdlb"
},
"apiSignature": {
"type": "API",
"path": "_31tervvaz40jy7bn543hux0hji296ovd",
"value": "_6r9lcxjztpnlps4sby648drxmz02zdlb"
}
}
{
"code": "INVALID_SESSION",
"message": "Given token is invalid."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/applications/signature/verify ' \
--header 'Authorization: Bearer dktir7e0ebkt4nj3ttzu5c0h2gf9hl1d' \
--header 'Content-Type: application/json' \
--data-raw '{
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"signatureType": "FILE",
"pluginType": "WORDPRESS"
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get domain verification signature
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
SignatureType signatureType = SignatureType.File;
PluginType pluginType = PluginType.WORDPRESS;
Boolean verifyStatus = client.verifySignature(applicationToken, signatureType, pluginType);
{
"code": "SUCCESS",
"message": "Verification success."
}
{
"code": "FAILED",
"message": "Verification failed."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request POST \
'https://api.beaglesecurity.com/rest/v2/test/start' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"applicationToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Start a test
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
StartTest startTestResult = client.startTest(applicationToken);
{
"code": "SUCCESS",
"statusUrl": "https://api.dev.beaglesecure.com/rest/v2/test/status",
"resultUrl": "https://api.dev.beaglesecure.com/rest/v2/test/result",
"resultToken": "1ry0hrn7bt8kwiuayrul7a2ka8vp7if5",
"message": "Test has been started successfully."
}
{
"code": "INVALID_SESSION",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/test/status?application_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&result_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get test status
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String resultToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
TestStatus testStatus = client.getTestStatus(applicationToken, resultToken);
{
"status": "running",
"progress": 3,
"code": "SUCCESS",
"message": "Test is in progress."
}
{
"code": "FAILED",
"message": "Get status failed."
}
curl --location --request POST \
'https://api.beaglesecurity.com/rest/v2/test/stop' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"applicationToken": "3frv64jxnaa89okc20jfyys1n8dwhgnx"
}'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Stop a test
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
Boolean testStatus = client.stopTest(applicationToken);
{
"code": "SUCCESS",
"message": "Stop request has been sent successfully ."
}
{
"code": "FAILED",
"message": "Stop test failed."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET
'https://api.beaglesecurity.com/rest/v2/test/result?application_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&result_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get test result
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String resultToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
TestStatus testStatus = client.getTestResultJson(applicationToken, resultToken);
{
"code": "SUCCESS",
"message": "Test result returned successfully"
"result": "{\n \"project_name\": \"teststage\",\n \"application_name\": \"test stage\",\n \"url\": \"http://example.com\",\n \"generated_date\": \"04 Sep 2021\",\n \"approved_date\": \"04 Sep 2021\",\n
.
.
.
-headers that disclose information.\\n* Removing any unnecessary comments.\\n* Removing all the META and generator tags\",\n \"occurences\": [\n {\n \"status\": \"Fixed\",\n \"vulnerability\": {\n \"Method\": \"get\",\n \"Url\": \"http://example.com/Templatize.asp\"\n }\n }\n ]\n }\n ]\n}",
}
{
"code": "INVALID_SESSION",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/test/sessions?application_token=c2bzdnqzlwtxer7pczakwr4ly5zas1qa&count=20' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get test sessions of application
String applicationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
List<TestSession> testSession = client.getTestSessions(applicationToken, 20);
{
"code": "SUCCESS",
"message": "Success."
"sessions": [
{
"resultToken": "s14gbjsvghjnicpf7jw09xh91rhf4bxx",
"startTime": 1630742492974,
"endTime": 1630742531775,
},
{
"resultToken": "3qy7cuy69nis0lp0p988c0df8om2mn90",
"startTime": 1630740444141,
"endTime": 1630741619924,
},
{
"resultToken": "g0einbv7iayf4zdev2rza4vuvp5o5gpa",
"startTime": 1624824208627,
"endTime": 1624829998223,
},
]
}
{
"code": "INVALID_APPLICATION_TOKEN",
"message": "Given token is invalid"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.beaglesecurity.com/rest/v2/test/runningsessions' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get all running test sessions
List<TestSession> testSession = client.getTestRunningSessions();
{
"code": null,
"message": null,
"sessions": [
{
"title": "Example 1",
"url": "https://example1.com",
"applicationToken": "f6weim5t7h2f1m855l85pms5bsn0kgw4",
"resultToken": "lkjvfdsavgldba678w2bh2brfwfwfwgb",
"startTime": 1628712549237,
},
{
"title": "Example 2",
"url": "http://example2.com",
"applicationToken": "ljh465jgjl62g2lujg642kjg764264rj",
"resultToken": "3qy7cuy69nis0lp0p988c0df8om2mn90",
"startTime": 1630740413141,
},
{
"title": "Example 3",
"url": "http://example3.com",
"applicationToken": "9quf44bokfy0vto2kjlmush2zglr9wn7",
"resultToken": "3c7gnxoisjw3ys3b2s5fcbbr9ud3rtku",
"startTime": 1630742949524,
}
],
}
{
"code": "FAILED",
"message": "Get result failed"
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request GET \
'https://api.dev.beaglesecure.com/rest/v2/test/runningsessions?teamid=xxxxxxxxxx' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
// This token will be generated from Beagle security settings -> Access token
BeagleSecurityClient client = BeagleSecurityClientBuilder.instance()
.withAPIToken("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
// Get all running test sessions (with team)
String teamId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
List<TestRunningSession> testRunningSession = client.getTeamTestRunningSessions(teamId);
{
"code": null,
"message": null,
"sessions": [
{
"title": "Example 1",
"url": "https://example1.com",
"applicationToken": "9quf44bokfy0vto2kjlmush2zglr9wn7",
"resultToken": "6mynp3a2gyw9gb2k45jb158byk1n3dym",
"startTime": 1628712549237,
},
{
"title": "Example 2",
"url": "http://example2.com",
"applicationToken": "9quf44bokfy0vto2kjlmush2zglr9wn7",
"resultToken": "6mynp3a2gyw9gb2k45jb158byk1n3dym",
"startTime": 1630740413141,
}
]
}
{
"code": "PLAN_NOT_SUPPORTED",
"message": "Your plan does not support this feature."
}
{
"code": "NOT_AUTHORIZED",
"message": "Not authorized"
}
curl --location --request POST \
'https://api.beaglesecurity.com/v1/test/start' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_token":"7i8cesnridfk0ha65ufm03gctsikiici",
"application_token": "1iwg9chvbqb2uxvtxd8c3bf9c5t026xu"
}'
{
"status": "Success",
"status_url": "https://api.beaglesecurity.com/v1/test/status",
"result_url": "https://api.beaglesecurity.com/v1/test/result",
"result_token": "rnlp8czjz8jssy4kl2f83l011bmexxyv",
"message": "Test has started successfully."
}
{
"status": "Failed",
"message": "Invalid application. Start test failed."
}
curl --location --request POST \
'https://api.beaglesecurity.com/v1/test/status' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_token":"7i8cesnridfk0ha65ufm03gctsikiici",
"application_token": "1iwg9chvbqb2uxvtxd8c3bf9c5t026xu",
"result_token":"y4lwsplywaoz135n70b7d49537zk9pbo"
}'
{
"status": "running" ,
"progress": 30,
"message": "Test has started successfully."
}
{
"status": "Failed",
"message": "Invalid application. Start test failed."
}
curl --location --request POST \
'https://api.beaglesecurity.com/v1/test/result' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_token":"7i8cesnridfk0ha65ufm03gctsikiici",
"application_token": "1iwg9chvbqb2uxvtxd8c3bf9c5t026xu",
"result_token":"y4lwsplywaoz135n70b7d49537zk9pbo"
}'
{
"status": "Success",
"result": "{result_json}",
"message": "Test has started successfully."
}
{
"status": "Failed",
"result": "null",
"message": "Invalid applicationtoken found."
}
curl --location --request POST \
'https://api.beaglesecurity.com/v1/test/stop' \
--header 'Content-Type: application/json' \
--data-raw '{
"access_token":"7i8cesnridfk0ha65ufm03gctsikiici",
"application_token": "1iwg9chvbqb2uxvtxd8c3bf9c5t026xu"
}'
{
"status": "Success" ,
"message": "Stop request has sent successfully."
}
{
"status": "Failed" ,
"message": "Invalid application provided. Stop test failed."
}