Skip to main content
POST
/
shell-docs
/
{namespace}
/
grep
Shell Docs Grep
curl --request POST \
  --url https://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "pattern": "<string>",
  "path": "",
  "case_sensitive": false,
  "whole_word": false,
  "fixed_string": false,
  "max_total_matches": 100,
  "max_matches_per_file": 10,
  "context_lines": 3,
  "lines_before": 123,
  "lines_after": 123,
  "output_mode": "content",
  "multiline_content": false
}
'
import requests

url = "https://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep"

payload = {
    "pattern": "<string>",
    "path": "",
    "case_sensitive": False,
    "whole_word": False,
    "fixed_string": False,
    "max_total_matches": 100,
    "max_matches_per_file": 10,
    "context_lines": 3,
    "lines_before": 123,
    "lines_after": 123,
    "output_mode": "content",
    "multiline_content": False
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    pattern: '<string>',
    path: '',
    case_sensitive: false,
    whole_word: false,
    fixed_string: false,
    max_total_matches: 100,
    max_matches_per_file: 10,
    context_lines: 3,
    lines_before: 123,
    lines_after: 123,
    output_mode: 'content',
    multiline_content: false
  })
};

fetch('https://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep', 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://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep",
  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([
    'pattern' => '<string>',
    'path' => '',
    'case_sensitive' => false,
    'whole_word' => false,
    'fixed_string' => false,
    'max_total_matches' => 100,
    'max_matches_per_file' => 10,
    'context_lines' => 3,
    'lines_before' => 123,
    'lines_after' => 123,
    'output_mode' => 'content',
    'multiline_content' => false
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$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://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep"

	payload := strings.NewReader("{\n  \"pattern\": \"<string>\",\n  \"path\": \"\",\n  \"case_sensitive\": false,\n  \"whole_word\": false,\n  \"fixed_string\": false,\n  \"max_total_matches\": 100,\n  \"max_matches_per_file\": 10,\n  \"context_lines\": 3,\n  \"lines_before\": 123,\n  \"lines_after\": 123,\n  \"output_mode\": \"content\",\n  \"multiline_content\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"pattern\": \"<string>\",\n  \"path\": \"\",\n  \"case_sensitive\": false,\n  \"whole_word\": false,\n  \"fixed_string\": false,\n  \"max_total_matches\": 100,\n  \"max_matches_per_file\": 10,\n  \"context_lines\": 3,\n  \"lines_before\": 123,\n  \"lines_after\": 123,\n  \"output_mode\": \"content\",\n  \"multiline_content\": false\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://apigcp.trynia.ai/v2/shell-docs/{namespace}/grep")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"pattern\": \"<string>\",\n  \"path\": \"\",\n  \"case_sensitive\": false,\n  \"whole_word\": false,\n  \"fixed_string\": false,\n  \"max_total_matches\": 100,\n  \"max_matches_per_file\": 10,\n  \"context_lines\": 3,\n  \"lines_before\": 123,\n  \"lines_after\": 123,\n  \"output_mode\": \"content\",\n  \"multiline_content\": false\n}"

response = http.request(request)
puts response.read_body
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Path Parameters

namespace
string
required

Body

application/json
pattern
string
required

Regex pattern

path
string
default:""

Path prefix filter

case_sensitive
boolean
default:false
whole_word
boolean
default:false
fixed_string
boolean
default:false
max_total_matches
integer
default:100
Required range: 1 <= x <= 10000
max_matches_per_file
integer
default:10
Required range: 1 <= x <= 100
context_lines
integer
default:3
Required range: 0 <= x <= 10
lines_before
integer | null
lines_after
integer | null
output_mode
string
default:content

content|files_with_matches|count

multiline_content
boolean
default:false

Response

Successful Response