diff --git a/c-sharp/detectify.cs b/c-sharp/detectify.cs index 785688f..10fb1d4 100644 --- a/c-sharp/detectify.cs +++ b/c-sharp/detectify.cs @@ -37,7 +37,7 @@ public class Detectify /// /// Detectify API endpoint, without a trailing slash. /// - private const string Endpoint = "https://api.detectify.com/rest/v2"; + private const string Endpoint = "https://api.detectify.com/rest"; private string ApiKey { get; } private string SecretKey { get; } @@ -84,7 +84,7 @@ private Dictionary MakeHeaders(string method, string path, /// Returns true if a scan was started, false if not. public async Task StartScanAsync(string scanProfile) { - var path = $"/scans/{scanProfile}/"; + var path = $"/v2/scans/{scanProfile}/"; var url = $"{Endpoint}{path}"; var timestamp = DateTime.UtcNow; @@ -139,7 +139,7 @@ public async Task StartScanAsync(string scanProfile) /// The scan profile token to check scan status for. public async Task ScanStatusAsync(string scanProfile) { - var path = $"/scans/{scanProfile}/"; + var path = $"/v2/scans/{scanProfile}/"; var url = $"{Endpoint}{path}"; var timestamp = DateTime.UtcNow; diff --git a/java/Detectify.java b/java/Detectify.java index 03efce9..c6233ed 100644 --- a/java/Detectify.java +++ b/java/Detectify.java @@ -18,7 +18,7 @@ public class Detectify { /** * Detectify API endpoint, no trailing slash */ - private static final String Endpoint = "https://api.detectify.com/rest/v2"; + private static final String Endpoint = "https://api.detectify.com/rest"; private String apiKey; private String secretKey; @@ -72,7 +72,7 @@ public boolean StartScan(String scanProfile) { Date timestamp = new Date(); // Format API request URL - String path = String.format("/scans/%s/", scanProfile); + String path = String.format("/v2/scans/%s/", scanProfile); String method = "POST"; URL url; @@ -137,7 +137,7 @@ public void ScanStatus(String scanProfile) { Date timestamp = new Date(); // Format API request URL - String path = String.format("/scans/%s/", scanProfile); + String path = String.format("/v2/scans/%s/", scanProfile); String method = "GET"; URL url; diff --git a/node/detectify.js b/node/detectify.js index 8f3dd94..a89505e 100644 --- a/node/detectify.js +++ b/node/detectify.js @@ -4,7 +4,7 @@ const crypto = require('crypto') const fetch = require('node-fetch') // The endpoint to Detectify's API, no trailing slash -const DetectifyEndpoint = 'https://api.detectify.com/rest/v2' +const DetectifyEndpoint = 'https://api.detectify.com/rest' // Generate the headers to use for API calls. If `secretKey` is not null, its value will be used to create // the signature headers. `body` should be omitted unless the call requires a JSON payload. @@ -43,7 +43,7 @@ function signatureHeaders(apiKey, secretKey, method, path, timestamp, body) { // Starts a scan for the provided scan profile. Returns true if the scan was started, false if not. function startScan(scanProfile, apiKey, secretKey) { - const path = `/scans/${scanProfile}/` + const path = `/v2/scans/${scanProfile}/` const url = `${DetectifyEndpoint}${path}` const timestamp = Math.floor(new Date() / 1000) @@ -90,7 +90,7 @@ function startScan(scanProfile, apiKey, secretKey) { // Returns the scan status as JSON if the scan is running. function scanStatus(scanProfile, apiKey, secretKey) { - const path = `/scans/${scanProfile}/` + const path = `/v2/scans/${scanProfile}/` const url = `${DetectifyEndpoint}${path}` const timestamp = Math.floor(new Date() / 1000) diff --git a/php/detectify.php b/php/detectify.php index a855f71..e129fd6 100644 --- a/php/detectify.php +++ b/php/detectify.php @@ -6,7 +6,7 @@ class Detectify { // Detectify API endpoint, no trailing slash - private const ENDPOINT = "https://api.detectify.com/rest/v2"; + private const ENDPOINT = "https://api.detectify.com/rest"; private $api_key; private $secret_key; @@ -48,7 +48,7 @@ function makeHeaders($method, $path, $timestamp, $body = null) */ function startScan($scan_profile) { - $path = "/scans/$scan_profile/"; + $path = "/v2/scans/$scan_profile/"; $url = self::ENDPOINT . $path; $timestamp = time(); @@ -94,7 +94,7 @@ function startScan($scan_profile) */ function scanStatus($scan_profile) { - $path = "/scans/$scan_profile/"; + $path = "/v2/scans/$scan_profile/"; $url = self::ENDPOINT . $path; $timestamp = time(); diff --git a/python/detectify-2.7.py b/python/detectify-2.7.py index c10edc5..a6eeb80 100644 --- a/python/detectify-2.7.py +++ b/python/detectify-2.7.py @@ -11,7 +11,7 @@ # Detectify public API endpoint, no trailing slash # Python 2.7 -ENDPOINT = 'https://api.detectify.com/rest/v2' +ENDPOINT = 'https://api.detectify.com/rest' # API response codes response_codes = { @@ -72,37 +72,37 @@ def request(api_key, secret_key, path, method): return def start_scan(scan_profile, api_key, secret_key): - path = "/scans/"+scan_profile+"/" + path = "/v2/scans/"+scan_profile+"/" req = request(api_key, secret_key, path, 'POST') if req != None: print req.text def stop_scan(scan_profile, api_key, secret_key): - path = "/scans/"+scan_profile+"/" + path = "/v2/scans/"+scan_profile+"/" req = request(api_key, secret_key, path, 'DELETE') if req != None: print req.text def scan_status(scan_profile, api_key, secret_key): - path = "/scans/"+scan_profile+"/" + path = "/v2/scans/"+scan_profile+"/" req = request(api_key, secret_key, path, 'GET') if req != None: print req.text def get_domains(api_key, secret_key): - path = "/domains/" + path = "/v2/domains/" req = request(api_key, secret_key, path, 'GET') if req != None: print eval(req.text) def get_domain_profiles(api_key, secret_key, domain_token): - path = "/profiles/"+domain_token+"/" + path = "/v2/profiles/"+domain_token+"/" req = request(api_key, secret_key, path, 'GET') if req != None: print eval(req.text) def get_all_profiles(api_key, secret_key): - path = "/profiles/" + path = "/v2/profiles/" req = request(api_key, secret_key, path, 'GET') if req != None: return eval(req.text) diff --git a/python/detectify.py b/python/detectify.py index e808fe5..caf6b1c 100644 --- a/python/detectify.py +++ b/python/detectify.py @@ -6,7 +6,7 @@ import time # Detectify public API endpoint, no trailing slash -ENDPOINT = 'https://api.detectify.com/rest/v2' +ENDPOINT = 'https://api.detectify.com/rest' def make_headers(api_key, secret_key, method, path, timestamp, body=None): @@ -35,7 +35,7 @@ def make_signature(api_key, secret_key, method, path, timestamp, body=None): def start_scan(scan_profile, api_key, secret_key): - path = f"/scans/{scan_profile}/" + path = f"/v2/scans/{scan_profile}/" url = f"{ENDPOINT}{path}" timestamp = int(time.time()) headers = make_headers(api_key, secret_key, 'POST', path, timestamp) @@ -64,7 +64,7 @@ def start_scan(scan_profile, api_key, secret_key): def scan_status(scan_profile, api_key, secret_key): - path = f"/scans/{scan_profile}/" + path = f"/v2/scans/{scan_profile}/" url = f"{ENDPOINT}{path}" timestamp = int(time.time()) headers = make_headers(api_key, secret_key, 'GET', path, timestamp) diff --git a/ruby/detectify.rb b/ruby/detectify.rb index 36ff01a..3831d29 100644 --- a/ruby/detectify.rb +++ b/ruby/detectify.rb @@ -7,7 +7,7 @@ module Detectify # Base endpoint to the Detectify API, no trailing slash - ENDPOINT = 'https://api.detectify.com/rest/v2'.freeze + ENDPOINT = 'https://api.detectify.com/rest'.freeze # Generates signature headers. Returns a map of headers to pass along with the call. def self.signature(api_key, secret_key, method, url, timestamp, body='') @@ -40,7 +40,7 @@ def self.create_headers(method, path, api_key, secret_key = nil) # Starts a new scan on the provided scan profile. Returns true if the scan was started, # false if it was not started. def self.start_scan(scan_profile, api_key, secret_key=nil) - path = "/scans/#{scan_profile}/" + path = "/v2/scans/#{scan_profile}/" url = "#{ENDPOINT}#{path}" # Create headers for the call @@ -83,7 +83,7 @@ def self.start_scan(scan_profile, api_key, secret_key=nil) # Prints the status of a currently running scan. def self.scan_status(scan_profile, api_key, secret_key = nil) - path = "/scans/#{scan_profile}/" + path = "/v2/scans/#{scan_profile}/" url = "#{ENDPOINT}#{path}" # Create headers for the call