### Example of googleBurstKeywordDifficultyLive API call with authentication setup and sample request info and API call await api.googleBulkKeywordDifficultyLive([task;-) Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/DataforseoLabsApi.md This example shows how to instantiate DataSFor...'s DataSForLabsApi with custom fetch wrapper that injects Basic Auth from username and configurable endpoint URL, then constructs a request info with location 2840/language code ```typescript const username = 'USERNAME ``` -------------------------------- ### aiKeywordDataLocationsAndLanguages example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/AiOptimizationApi.md TypeScript example for calling aiKeywordDataLocationsAndLanguages. Uses the same authentication setup as the previous example and invokes the method with no parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new AiOptimizationApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.aiKeywordDataLocationsAndLanguages(); ``` -------------------------------- ### Example: Setting up SerpApi client and posting a local finder task Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to instantiate SerpApi with basic authentication and create a SerpGoogleLocalFinderTaskPostRequestInfo with parameters such as language_code, location_code, keyword, min_rating, and time_filter, then call googleLocalFinderTaskPost. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new SerpGoogleLocalFinderTaskPostRequestInfo(); task.language_code = "en"; task.location_code = 2840; task.keyword = "local nail services"; task.min_rating = 4.5; task.time_filter = "monday"; let response = await api.googleLocalFinderTaskPost([task]); ``` -------------------------------- ### businessListingsCategories - TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/BusinessDataApi.md Example for calling the businessListingsCategories endpoint. It uses the same authentication setup as the previous example and invokes the method. No parameters are required. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new BusinessDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.businessListingsCategories(); ``` -------------------------------- ### Example: Using googleSerpCompetitorsLive with authentication and parameters Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/DataforseoLabsApi.md This example shows how to use the DataforseoLabs TypeScript client to call the `googleSerpCompetitorsLive` method. It demonstrates setting up basic authentication from `USERNAME` and `PASSWORD`, creating a `DataforseoLabsGoogleSerpCompetitorsLiveRequestInfo` with keywords, language, location, item types, and limit, and then invoking the API method. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new DataforseoLabsApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new DataforseoLabsGoogleSerpCompetitorsLiveRequestInfo(); task.keywords = [ "phone", ]; task.language_name = "English"; task.location_code = 2840; task.item_types = [ "organic", ]; task.limit = 5; let response = await api.googleSerpCompetitorsLive([task]); ``` -------------------------------- ### bingOrganicTasksFixed example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Example TypeScript code for calling the bingOrganicTasksFixed method. It uses the same authentication setup as the previous example and calls the method without parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.bingOrganicTasksFixed(); ``` -------------------------------- ### Example: googleDatasetSearchTaskPost with basic auth Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to create a SerpApi client with basic authentication and post a Google dataset search task. The example sets the keyword, last_updated, file_formats, usage_rights, is_free, and topics parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new SerpGoogleDatasetSearchTaskPostRequestInfo(); task.keyword = "water quality"; task.last_updated = "1m"; task.file_formats = [ "archive", "image", ]; task.usage_rights = "noncommercial"; task.is_free = true; task.topics = [ "natural_sciences", "geo", ]; let response = await api.googleDatasetSearchTaskPost([task]); ``` -------------------------------- ### TypeScript example for googleKeywordOverviewLive with basic auth Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/DataforseoLabsApi.md Shows how to set up the DataforseoLabsApi client with HTTP Basic authentication using the username and password, create a request with language_code, location_code, include_clickstream_data, include_serp_info, and keywords, and call googleKeywordOverviewLive. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new DataforseoLabsApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new DataforseoLabsGoogleKeywordOverviewLiveRequestInfo(); task.language_code = "en"; task.location_code = 2840; task.include_clickstream_data = true; task.include_serp_info = true; task.keywords = [ "iphone", ]; let response = await api.googleKeywordOverviewLive([task]); ``` -------------------------------- ### contentAnalysisAvailableFilters - TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/ContentAnalysisApi.md Shows how to call the contentAnalysisAvailableFilters method with no parameters. Uses the same basic auth setup as other examples. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new ContentAnalysisApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.contentAnalysisAvailableFilters(); ``` -------------------------------- ### Example: googleSearchByImageTaskPost with basic auth Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to create a SerpApi client with basic authentication and post a search-by-image task. The example sets language_code, location_code, and image_url, then calls googleSearchByImageTaskPost with an array containing one task. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new SerpGoogleSearchByImageTaskPostRequestInfo(); task.language_code = "en"; task.location_code = 2840; task.image_url = "https://dataforseo.com/wp-content/uploads/2016/11/data_for_seo_light_429.png"; let response = await api.googleSearchByImageTaskPost([task]); ``` -------------------------------- ### keywordsDataBingLanguages - TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/KeywordsDataApi.md Example for calling the keywordsDataBingLanguages endpoint. Uses the same client setup with basic auth as the previous example, then awaits the call. No parameters are required for this endpoint. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new KeywordsDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.keywordsDataBingLanguages(); ``` -------------------------------- ### youtubeLanguages example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Example of calling the youtubeLanguages endpoint. It uses the same basic authentication setup and calls the method without any parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.youtubeLanguages(); ``` -------------------------------- ### appDataTasksReady Example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/AppDataApi.md Demonstrates how to initialize the AppDataApi with basic authentication and call the appDataTasksReady method. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new AppDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.appDataTasksReady(); ``` -------------------------------- ### baiduOrganicTasksFixed example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Example of calling the baiduOrganicTasksFixed endpoint. It uses the same client setup with basic authentication and awaits the response. No parameters are required. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.baiduOrganicTasksFixed(); ``` -------------------------------- ### resources() TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/OnPageApi.md Example for calling the resources() method. It sets up basic authentication with username and password, creates an OnPageApi instance, builds an OnPageResourcesRequestInfo with id, filters, order_by, and limit, then awaits the response. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new OnPageApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new OnPageResourcesRequestInfo(); task.id = "07281559-0695-0216-0000-c269be8b7592"; task.filters = [ , "and", , ]; task.order_by = [ "size,desc", ]; task.limit = 10; let response = await api.resources([task]); ``` -------------------------------- ### seznamLanguages - TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Example of calling the seznamLanguages endpoint with no parameters. It uses the same client setup with basic authentication. The endpoint returns a SerpSeznamLanguagesResponseInfo. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.seznamLanguages(); ``` -------------------------------- ### amazonBulkSearchVolumeLive TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/DataforseoLabsApi.md Example usage of the amazonBulkSearchVolumeLive method with basic authentication and request setup, including keyword, location, and language parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new DataforseoLabsApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new DataforseoLabsAmazonBulkSearchVolumeLiveRequestInfo(); task.keywords = [ "buy laptop", "cheap laptops for sale", "purchase laptop", ]; task.location_code = 2840; task.language_code = "en"; let response = await api.amazonBulkSearchVolumeLive([task]); ``` -------------------------------- ### googleKeywordIdeasLive implementation Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/DataforseoLabsApi.md Example showing how to initialize the DataforseoLabsApi with basic authentication and perform a live keyword ideas request. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new DataforseoLabsApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new DataforseoLabsGoogleKeywordIdeasLiveRequestInfo(); task.keywords = [ "phone", "watch", ]; task.location_code = 2840; task.language_code = "en"; task.include_serp_info = true; task.limit = 3; let response = await api.googleKeywordIdeasLive([task]); ``` -------------------------------- ### googleAdsSearchTaskPost example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to set up authentication, create a SerpGoogleAdsSearchTaskPostRequestInfo with location_code, platform, and advertiser_ids, then call googleAdsSearchTaskPost with an array of tasks. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new SerpGoogleAdsSearchTaskPostRequestInfo(); task.location_code = 2840; task.platform = "google_search"; task.advertiser_ids = [ "AR13752565271262920705", "AR02439908557932462081", ]; let response = await api.googleAdsSearchTaskPost([task]); ``` -------------------------------- ### bingKeywordsForKeywordsTaskGet Basic Authentication Example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/KeywordsDataApi.md Similar setup as the previous example, but calls the bingKeywordsForKeywordsTaskGet endpoint with a task ID parameter. The endpoint requires an 'id' parameter (example UUID provided) and returns a KeywordsDataBingKeywordsForKeywordsTaskGetResponseInfo object. ```TypeScript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new KeywordsDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let id = "00000000-0000-0000-0000-000000000000"; let response = await api.bingKeywordsForKeywordsTaskGet(id); ``` -------------------------------- ### googleMapsTasksReady TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to call googleMapsTasksReady with the same authentication setup, requiring no parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.googleMapsTasksReady(); ``` -------------------------------- ### status example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/DataforseoLabsApi.md Shows how to initialize the DataforseoLabsApi client with basic authentication and call the status method, which requires no parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new DataforseoLabsApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.status(); ``` -------------------------------- ### businessListingsSearchLive Example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/BusinessDataApi.md Example showing how to instantiate BusinessDataApi with basic authentication and call businessListingsSearchLive with a request object containing filters, categories, and other parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new BusinessDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new BusinessDataBusinessListingsSearchLiveRequestInfo(); task.categories = [ "pizza_restaurant", ]; task.description = "pizza"; task.title = "pizza"; task.is_claimed = true; task.location_coordinate = "53.476225,-2.243572,10"; task.order_by = [ "rating.value,desc", ]; task.filters = [ , ]; task.limit = 3; let response = await api.businessListingsSearchLive([task]); ``` -------------------------------- ### googleNewsTasksReady TypeScript example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to call googleNewsTasksReady with the same Basic auth setup. This endpoint does not need any parameters. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.googleNewsTasksReady(); ``` -------------------------------- ### Call bingKeywordsForSiteTaskGet with an id parameter Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/KeywordsDataApi.md Shows a similar client setup as the ready example, but calls bingKeywordsForSiteTaskGet with an id string variable (e.g., a UUID). The endpoint requires no parameter according to the docs, but the example passes an id. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new KeywordsDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let id = "00000000-0000-0000-0000-000000000000"; let response = await api.bingKeywordsForSiteTaskGet(id); ``` -------------------------------- ### googleAppListTasksReady Example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/AppDataApi.md Demonstrates how to initialize the AppDataApi with basic authentication and call the googleAppListTasksReady method. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new AppDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.googleAppListTasksReady(); ``` -------------------------------- ### Call languages() with basic auth Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/ContentAnalysisApi.md Example for the languages() endpoint. It uses the same client setup with basic authentication and calls languages(). No parameters are required. ```TypeScript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new ContentAnalysisApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.languages(); ``` -------------------------------- ### appleAppListingsSearchLive - Basic Auth Example Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/AppDataApi.md Example for the appleAppListingsSearchLive endpoint. It creates an AppDataAppleAppListingsSearchLiveRequestInfo object with title, description, categories, order_by, filters, and limit, then calls appleAppListingsSearchLive([task]). ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new AppDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new AppDataAppleAppListingsSearchLiveRequestInfo(); task.title = "vpn"; task.description = "vpn"; task.categories = [ "Utilities", ]; task.order_by = [ "item.rating.value,desc", ]; task.filters = [ , ]; task.limit = 10; let response = await api.appleAppListingsSearchLive([task]); ``` -------------------------------- ### TypeScript example for googleImagesLiveHtml Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to initialize the SerpApi client with basic auth and call googleImagesLiveHtml with a task containing language, location, and keyword. The example uses a custom fetch wrapper to add the Authorization header. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new SerpGoogleImagesLiveHtmlRequestInfo(); task.language_code = "en"; task.location_code = 2840; task.keyword = "albert einstein"; let response = await api.googleImagesLiveHtml([task]); ``` -------------------------------- ### Call googleAutocompleteTasksFixed with basic auth Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md TypeScript example for the googleAutocompleteTasksFixed method. It uses the same client setup with basic authentication and calls the method. No parameters are required. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.googleAutocompleteTasksFixed(); ``` -------------------------------- ### Example: googleFinanceQuoteTaskPost with basic auth Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/SerpApi.md Shows how to create a SerpApi client with basic authentication and submit a Google Finance quote task. The example sets the keyword to '.DJI:INDEXDJX', location_code to 2840, and language_name to 'English'. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new SerpApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let task = new SerpGoogleFinanceQuoteTaskPostRequestInfo(); task.keyword = ".DJI:INDEXDJX"; task.location_code = 2840; task.language_name = "English"; let response = await api.googleFinanceQuoteTaskPost([task]); ``` -------------------------------- ### Call bingSearchVolumeTasksReady with basic authentication Source: https://github.com/dataforseo/typescriptclient/blob/master/docs/KeywordsDataApi.md Authenticate using btoa-encoded Basic credentials, then call bingSearchVolumeTasksReady. The endpoint requires no parameters and returns a KeywordsDataBingSearchVolumeTasksReadyResponseInfo. The example shows the standard setup for using KeywordsDataApi. ```typescript const username = 'USERNAME'; const password = 'PASSWORD'; let api = new KeywordsDataApi("https://api.dataforseo.com", { fetch: (url: RequestInfo, init?: RequestInit): Promise => { const token = btoa(`${username}:${password}`); const authHeader = { 'Authorization': `Basic ${token}` }; const newInit: RequestInit = { ...init, headers: { ...init?.headers, ...authHeader, } }; return fetch(url, newInit); } }); let response = await api.bingSearchVolumeTasksReady(); ```