Skip to content

Latest commit

 

History

History
454 lines (311 loc) · 14.5 KB

File metadata and controls

454 lines (311 loc) · 14.5 KB

ScrapeBadger\ChatGPTApi

All URIs are relative to https://scrapebadger.com, except if the operation defines another base path.

Method HTTP request Description
chatgptAskChatgptAQuestion() GET /v1/chatgpt/ask Ask ChatGPT a question
chatgptAskChatgptAQuestionPost() POST /v1/chatgpt/ask Ask ChatGPT a question (POST)
chatgptChatgptScraperHealthCheck() GET /v1/chatgpt/health ChatGPT scraper health check
chatgptChatgptScraperHealthCheckHead() HEAD /v1/chatgpt/health ChatGPT scraper health check
chatgptListChatgptModels() GET /v1/chatgpt/models List ChatGPT models
chatgptMeasureABrandSVisibilityInAChatgptAnswer() GET /v1/chatgpt/brand-visibility Measure a brand's visibility in a ChatGPT answer
chatgptMeasureABrandSVisibilityInAChatgptAnswerPost() POST /v1/chatgpt/brand-visibility Measure a brand's visibility in a ChatGPT answer (POST)

chatgptAskChatgptAQuestion()

chatgptAskChatgptAQuestion($prompt, $country, $web_search, $image_url): mixed

Ask ChatGPT a question

Send a prompt to ChatGPT and get the answer plus the web sources it cited.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$prompt = 'prompt_example'; // string | The prompt to send to ChatGPT (max 4096 characters).
$country = 'country_example'; // string | ISO-3166 alpha-2 egress country, e.g. 'US', 'GB', 'DE'.
$web_search = 'auto'; // string | auto (let ChatGPT decide) | force (ask it to browse) | off (answer from memory). `web_search_triggered` in the response always reports what actually happened.
$image_url = 'image_url_example'; // string | Public http(s) URL of an image to attach to the prompt. ChatGPT reads it and answers about it. POST also accepts `image_base64`. Exactly one of the two.

try {
    $result = $apiInstance->chatgptAskChatgptAQuestion($prompt, $country, $web_search, $image_url);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptAskChatgptAQuestion: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
prompt string The prompt to send to ChatGPT (max 4096 characters).
country string ISO-3166 alpha-2 egress country, e.g. 'US', 'GB', 'DE'. [optional]
web_search string auto (let ChatGPT decide) force (ask it to browse)
image_url string Public http(s) URL of an image to attach to the prompt. ChatGPT reads it and answers about it. POST also accepts `image_base64`. Exactly one of the two. [optional]

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

chatgptAskChatgptAQuestionPost()

chatgptAskChatgptAQuestionPost(): mixed

Ask ChatGPT a question (POST)

POST form of /ask, for prompts too long for a query string.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->chatgptAskChatgptAQuestionPost();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptAskChatgptAQuestionPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

chatgptChatgptScraperHealthCheck()

chatgptChatgptScraperHealthCheck(): mixed

ChatGPT scraper health check

Check health of the ChatGPT scraper service (accepts HEAD).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->chatgptChatgptScraperHealthCheck();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptChatgptScraperHealthCheck: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

chatgptChatgptScraperHealthCheckHead()

chatgptChatgptScraperHealthCheckHead(): mixed

ChatGPT scraper health check

Check health of the ChatGPT scraper service (accepts HEAD).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->chatgptChatgptScraperHealthCheckHead();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptChatgptScraperHealthCheckHead: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

chatgptListChatgptModels()

chatgptListChatgptModels($country): mixed

List ChatGPT models

Models chatgpt.com currently serves to an anonymous visitor.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$country = 'country_example'; // string | ISO-3166 alpha-2 egress country.

try {
    $result = $apiInstance->chatgptListChatgptModels($country);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptListChatgptModels: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
country string ISO-3166 alpha-2 egress country. [optional]

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

chatgptMeasureABrandSVisibilityInAChatgptAnswer()

chatgptMeasureABrandSVisibilityInAChatgptAnswer($prompt, $brand, $domain, $aliases, $competitors, $country, $web_search): mixed

Measure a brand's visibility in a ChatGPT answer

Ask ChatGPT, then report whether the brand is mentioned, cited and how prominently.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$prompt = 'prompt_example'; // string | The prompt to ask ChatGPT.
$brand = 'brand_example'; // string | Brand name to look for in the answer.
$domain = 'domain_example'; // string | Brand domain, for citation matching.
$aliases = 'aliases_example'; // string | Comma-separated alternative names.
$competitors = 'competitors_example'; // string | Comma-separated competitor names.
$country = 'country_example'; // string | ISO-3166 alpha-2 egress country.
$web_search = 'force'; // string | auto | force | off

try {
    $result = $apiInstance->chatgptMeasureABrandSVisibilityInAChatgptAnswer($prompt, $brand, $domain, $aliases, $competitors, $country, $web_search);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptMeasureABrandSVisibilityInAChatgptAnswer: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
prompt string The prompt to ask ChatGPT.
brand string Brand name to look for in the answer.
domain string Brand domain, for citation matching. [optional]
aliases string Comma-separated alternative names. [optional]
competitors string Comma-separated competitor names. [optional]
country string ISO-3166 alpha-2 egress country. [optional]
web_search string auto force

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

chatgptMeasureABrandSVisibilityInAChatgptAnswerPost()

chatgptMeasureABrandSVisibilityInAChatgptAnswerPost(): mixed

Measure a brand's visibility in a ChatGPT answer (POST)

POST form, for longer prompts and larger competitor sets.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKeyAuth
$config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = ScrapeBadger\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');


$apiInstance = new ScrapeBadger\Api\ChatGPTApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->chatgptMeasureABrandSVisibilityInAChatgptAnswerPost();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ChatGPTApi->chatgptMeasureABrandSVisibilityInAChatgptAnswerPost: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

mixed

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]