V2 File Search
Create File Search Job
Create an asynchronous file-search job.
POST
https://oathnet.org/api
/
service
/
v2
/
file-search
Create File Search Job
curl --request POST \
--url https://oathnet.org/api/service/v2/file-search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"log_ids": [
"<string>"
],
"expression": "<string>",
"include_matches": true,
"case_sensitive": true,
"context_lines": 123,
"file_pattern": "<string>",
"max_matches": 123
}
'import requests
url = "https://oathnet.org/api/service/v2/file-search"
payload = {
"log_ids": ["<string>"],
"expression": "<string>",
"include_matches": True,
"case_sensitive": True,
"context_lines": 123,
"file_pattern": "<string>",
"max_matches": 123
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
log_ids: ['<string>'],
expression: '<string>',
include_matches: true,
case_sensitive: true,
context_lines: 123,
file_pattern: '<string>',
max_matches: 123
})
};
fetch('https://oathnet.org/api/service/v2/file-search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://oathnet.org/api/service/v2/file-search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'log_ids' => [
'<string>'
],
'expression' => '<string>',
'include_matches' => true,
'case_sensitive' => true,
'context_lines' => 123,
'file_pattern' => '<string>',
'max_matches' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://oathnet.org/api/service/v2/file-search"
payload := strings.NewReader("{\n \"log_ids\": [\n \"<string>\"\n ],\n \"expression\": \"<string>\",\n \"include_matches\": true,\n \"case_sensitive\": true,\n \"context_lines\": 123,\n \"file_pattern\": \"<string>\",\n \"max_matches\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://oathnet.org/api/service/v2/file-search")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"log_ids\": [\n \"<string>\"\n ],\n \"expression\": \"<string>\",\n \"include_matches\": true,\n \"case_sensitive\": true,\n \"context_lines\": 123,\n \"file_pattern\": \"<string>\",\n \"max_matches\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://oathnet.org/api/service/v2/file-search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"log_ids\": [\n \"<string>\"\n ],\n \"expression\": \"<string>\",\n \"include_matches\": true,\n \"case_sensitive\": true,\n \"context_lines\": 123,\n \"file_pattern\": \"<string>\",\n \"max_matches\": 123\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"progress": {
"logs_total": 123,
"logs_completed": 123,
"files_total": 123,
"files_scanned": 123,
"percent": 123,
"updated_at": "2023-11-07T05:31:56Z"
},
"summary": {
"files_total": 123,
"files_scanned": 123,
"files_matched": 123,
"matches": 123,
"duration_ms": 123,
"bytes_scanned": 123,
"timeouts": 123,
"budget_exceeded": true,
"truncated": true
},
"matches": [
{
"log_id": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"relative_path": "<string>",
"size_bytes": 123,
"match_text": "<string>",
"line_number": 123,
"column_range": {
"start": 123,
"end": 123
},
"snippet": {
"pre": [
"<string>"
],
"line": "<string>",
"post": [
"<string>"
],
"truncated": true
},
"extra": {}
}
],
"limits": {
"max_matches": 123,
"max_file_size_bytes": 123,
"byte_budget_bytes": 123,
"max_context_lines": 123,
"job_ttl_seconds": 123,
"max_log_ids": 123,
"max_expression_length": 123
},
"next_poll_after_ms": 123
}Authorizations
API key for authentication (lowercase header name)
Body
application/json
Response
200 - application/json
Raw file-search job snapshot
Available options:
queued, running, completed, canceled Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I
Create File Search Job
curl --request POST \
--url https://oathnet.org/api/service/v2/file-search \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"log_ids": [
"<string>"
],
"expression": "<string>",
"include_matches": true,
"case_sensitive": true,
"context_lines": 123,
"file_pattern": "<string>",
"max_matches": 123
}
'import requests
url = "https://oathnet.org/api/service/v2/file-search"
payload = {
"log_ids": ["<string>"],
"expression": "<string>",
"include_matches": True,
"case_sensitive": True,
"context_lines": 123,
"file_pattern": "<string>",
"max_matches": 123
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
log_ids: ['<string>'],
expression: '<string>',
include_matches: true,
case_sensitive: true,
context_lines: 123,
file_pattern: '<string>',
max_matches: 123
})
};
fetch('https://oathnet.org/api/service/v2/file-search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://oathnet.org/api/service/v2/file-search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'log_ids' => [
'<string>'
],
'expression' => '<string>',
'include_matches' => true,
'case_sensitive' => true,
'context_lines' => 123,
'file_pattern' => '<string>',
'max_matches' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://oathnet.org/api/service/v2/file-search"
payload := strings.NewReader("{\n \"log_ids\": [\n \"<string>\"\n ],\n \"expression\": \"<string>\",\n \"include_matches\": true,\n \"case_sensitive\": true,\n \"context_lines\": 123,\n \"file_pattern\": \"<string>\",\n \"max_matches\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://oathnet.org/api/service/v2/file-search")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"log_ids\": [\n \"<string>\"\n ],\n \"expression\": \"<string>\",\n \"include_matches\": true,\n \"case_sensitive\": true,\n \"context_lines\": 123,\n \"file_pattern\": \"<string>\",\n \"max_matches\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://oathnet.org/api/service/v2/file-search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"log_ids\": [\n \"<string>\"\n ],\n \"expression\": \"<string>\",\n \"include_matches\": true,\n \"case_sensitive\": true,\n \"context_lines\": 123,\n \"file_pattern\": \"<string>\",\n \"max_matches\": 123\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"progress": {
"logs_total": 123,
"logs_completed": 123,
"files_total": 123,
"files_scanned": 123,
"percent": 123,
"updated_at": "2023-11-07T05:31:56Z"
},
"summary": {
"files_total": 123,
"files_scanned": 123,
"files_matched": 123,
"matches": 123,
"duration_ms": 123,
"bytes_scanned": 123,
"timeouts": 123,
"budget_exceeded": true,
"truncated": true
},
"matches": [
{
"log_id": "<string>",
"file_id": "<string>",
"file_name": "<string>",
"relative_path": "<string>",
"size_bytes": 123,
"match_text": "<string>",
"line_number": 123,
"column_range": {
"start": 123,
"end": 123
},
"snippet": {
"pre": [
"<string>"
],
"line": "<string>",
"post": [
"<string>"
],
"truncated": true
},
"extra": {}
}
],
"limits": {
"max_matches": 123,
"max_file_size_bytes": 123,
"byte_budget_bytes": 123,
"max_context_lines": 123,
"job_ttl_seconds": 123,
"max_log_ids": 123,
"max_expression_length": 123
},
"next_poll_after_ms": 123
}