Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/tokenizedFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AuthType } from './types';
* Fetch wrapper that adds the authentication token to the request.
* Use this to call the ThoughtSpot APIs when using the visual embed sdk.
* The interface for this method is the same as Web `Fetch`.
* Learn more about the `Fetch` API [here](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
* @param input
* @param init
* @example
Expand All @@ -15,6 +16,33 @@ import { AuthType } from './types';
* // .. fetch options ..
* });
*```
*
* @example
* ```js
* // Example of a POST request to the ThoughtSpot API
*
* const apiLink = tsHost + "/api/rest/2.0/metadata/search";
* const apiResponse = await tokenizedFetch(apiLink, {
* method: "POST",
* // Add any other fetch options as needed
* headers: {
* "Content-type": "application/json",
* },
* // Add the body as needed
* body: JSON.stringify({
* metadata: [
* {
* identifier: pinboardId,
* },
* ],
* }),
* });
*
* // Get the response as json
* const apiResult = await apiResponse.json();
*
* console.log(apiResult);
* ```
* @version SDK: 1.28.0
* @group Global methods
*/
Expand Down
Loading