addBenchmark
Add a benchmark to an organization.
/api/v1/benchmarks
Usage and SDK Samples
curl -X POST \
-H "Authorization: [[apiKey]]" \
-H "Accept: application/json,application/xml" \
-H "Content-Type: application/json,application/xml" \
"http://localhost:8082/api/v1/benchmarks?organizationId=789" \
-d '{
"settings" : {
"projects" : [ {
"id" : 2,
"enabled" : true
}, {
"id" : 2,
"enabled" : true
} ],
"tests" : [ {
"datasetSetting" : {
"selectionType" : "COUNT",
"endIdx" : 7,
"indexes" : [ 1, 1 ],
"startIdx" : 6,
"batchSize" : 4,
"shuffle" : true,
"workers" : 7,
"fraction" : 1.2315135,
"numItems" : 1
},
"name" : "name",
"id" : 9,
"defenses" : [ {
"defenseParameters" : "defenseParameters",
"name" : "name",
"testId" : 5,
"filters" : [ {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
}, {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
} ],
"id" : 4
}, {
"defenseParameters" : "defenseParameters",
"name" : "name",
"testId" : 5,
"filters" : [ {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
}, {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
} ],
"id" : 4
} ],
"status" : "CANCELLED"
}, {
"datasetSetting" : {
"selectionType" : "COUNT",
"endIdx" : 7,
"indexes" : [ 1, 1 ],
"startIdx" : 6,
"batchSize" : 4,
"shuffle" : true,
"workers" : 7,
"fraction" : 1.2315135,
"numItems" : 1
},
"name" : "name",
"id" : 9,
"defenses" : [ {
"defenseParameters" : "defenseParameters",
"name" : "name",
"testId" : 5,
"filters" : [ {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
}, {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
} ],
"id" : 4
}, {
"defenseParameters" : "defenseParameters",
"name" : "name",
"testId" : 5,
"filters" : [ {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
}, {
"paper_link" : "paper_link",
"codebase_name" : "codebase_name",
"name" : "name",
"id" : 1,
"type" : "type",
"parameters" : "parameters",
"enabled" : true,
"tasks" : [ "tasks", "tasks" ],
"group" : [ "group", "group" ]
} ],
"id" : 4
} ],
"status" : "CANCELLED"
} ],
"tasks" : [ "tasks", "tasks" ]
},
"name" : "name"
}' \
-d '<BenchmarkRequest>
<name>aeiou</name>
</BenchmarkRequest>'
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.BenchmarkApi;
import java.io.File;
import java.util.*;
public class BenchmarkApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: JWT
ApiKeyAuth JWT = (ApiKeyAuth) defaultClient.getAuthentication("JWT");
JWT.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.setApiKeyPrefix("Token");
// Create an instance of the API class
BenchmarkApi apiInstance = new BenchmarkApi();
Long organizationId = 789; // Long | The organization ID.
BenchmarkRequest benchmarkRequest = ; // BenchmarkRequest |
try {
BenchmarkResponse result = apiInstance.addBenchmark(organizationId, benchmarkRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BenchmarkApi#addBenchmark");
e.printStackTrace();
}
}
}
import org.openapitools.client.api.BenchmarkApi;
public class BenchmarkApiExample {
public static void main(String[] args) {
BenchmarkApi apiInstance = new BenchmarkApi();
Long organizationId = 789; // Long | The organization ID.
BenchmarkRequest benchmarkRequest = ; // BenchmarkRequest |
try {
BenchmarkResponse result = apiInstance.addBenchmark(organizationId, benchmarkRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BenchmarkApi#addBenchmark");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: JWT)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Authorization"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"Authorization"];
// Create an instance of the API class
BenchmarkApi *apiInstance = [[BenchmarkApi alloc] init];
Long *organizationId = 789; // The organization ID. (default to null)
BenchmarkRequest *benchmarkRequest = ; //
// Add a benchmark to an organization.
[apiInstance addBenchmarkWith:organizationId
benchmarkRequest:benchmarkRequest
completionHandler: ^(BenchmarkResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var GuardAiPlatformApi = require('guard_ai_platform_api');
var defaultClient = GuardAiPlatformApi.ApiClient.instance;
// Configure API key authorization: JWT
var JWT = defaultClient.authentications['JWT'];
JWT.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//JWT.apiKeyPrefix['Authorization'] = "Token";
// Create an instance of the API class
var api = new GuardAiPlatformApi.BenchmarkApi()
var organizationId = 789; // {Long} The organization ID.
var benchmarkRequest = ; // {BenchmarkRequest}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.addBenchmark(organizationId, benchmarkRequest, callback);
using System;
using System.Diagnostics;
using guardai_api.Api;
using guardai_api.Client;
using guardai_api.Model;
namespace Example
{
public class addBenchmarkExample
{
public void main()
{
// Configure API key authorization: JWT
Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");
// Create an instance of the API class
var apiInstance = new BenchmarkApi();
var organizationId = 789; // Long | The organization ID. (default to null)
var benchmarkRequest = new BenchmarkRequest(); // BenchmarkRequest |
try {
// Add a benchmark to an organization.
BenchmarkResponse result = apiInstance.addBenchmark(organizationId, benchmarkRequest);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling BenchmarkApi.addBenchmark: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: JWT
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\BenchmarkApi();
$organizationId = 789; // Long | The organization ID.
$benchmarkRequest = ; // BenchmarkRequest |
try {
$result = $api_instance->addBenchmark($organizationId, $benchmarkRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BenchmarkApi->addBenchmark: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::BenchmarkApi;
# Configure API key authorization: JWT
$WWW::OPenAPIClient::Configuration::api_key->{'Authorization'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::OPenAPIClient::Configuration::api_key_prefix->{'Authorization'} = "Bearer";
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::BenchmarkApi->new();
my $organizationId = 789; # Long | The organization ID.
my $benchmarkRequest = WWW::OPenAPIClient::Object::BenchmarkRequest->new(); # BenchmarkRequest |
eval {
my $result = $api_instance->addBenchmark(organizationId => $organizationId, benchmarkRequest => $benchmarkRequest);
print Dumper($result);
};
if ($@) {
warn "Exception when calling BenchmarkApi->addBenchmark: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: JWT
openapi_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# openapi_client.configuration.api_key_prefix['Authorization'] = 'Bearer'
# Create an instance of the API class
api_instance = openapi_client.BenchmarkApi()
organizationId = 789 # Long | The organization ID. (default to null)
benchmarkRequest = # BenchmarkRequest |
try:
# Add a benchmark to an organization.
api_response = api_instance.add_benchmark(organizationId, benchmarkRequest)
pprint(api_response)
except ApiException as e:
print("Exception when calling BenchmarkApi->addBenchmark: %s\n" % e)
extern crate BenchmarkApi;
pub fn main() {
let organizationId = 789; // Long
let benchmarkRequest = ; // BenchmarkRequest
let mut context = BenchmarkApi::Context::default();
let result = client.addBenchmark(organizationId, benchmarkRequest, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
Name | Description |
---|---|
benchmarkRequest * |
benchmarkRequest |
Name | Description |
---|---|
organizationId* |
Long
(int64)
The organization ID.
Required
|