Skip to content
Open
Show file tree
Hide file tree
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
55 changes: 41 additions & 14 deletions docs/content/getting-started/setup-openfga/configuration.mdx

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/content/interacting/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ This section helps you integrate <ProductName format={ProductNameFormat.ShortFor
description: 'Implementing search with OpenFGA.',
to: 'interacting/search-with-permissions',
},
{
title: 'Calling Other Endpoints',
description: 'Make raw HTTP calls to endpoints not yet wrapped by the SDK, including streaming endpoints.',
to: 'interacting/raw-api-requests',
},
]}
/>
110 changes: 110 additions & 0 deletions docs/content/interacting/raw-api-requests.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: Calling Other Endpoints
sidebar_position: 9
slug: /interacting/raw-api-requests
description: Making raw HTTP calls to OpenFGA endpoints not yet wrapped by the SDK
---

import {
DocumentationNotice,
ExecuteApiRequestViewer,
ExecuteApiRequestPathParamsViewer,
ExecuteApiRequestDecodeViewer,
ExecuteApiRequestStreamingViewer,
ExecuteApiRequestErrorViewer,
ProductName,
ProductNameFormat,
RelatedSection,
SdkSetupPrerequisite,
} from '@components/Docs';

# Calling Other Endpoints

<DocumentationNotice />

In certain cases you may want to call API endpoints that are not yet available as dedicated methods in the <ProductName format={ProductNameFormat.ShortForm}/> SDK. Every SDK provides an **API Executor** that lets you make raw HTTP calls to any <ProductName format={ProductNameFormat.ShortForm}/> endpoint while still honoring the client configuration — including authentication, telemetry, retries, and error handling.

## When to use

This is useful when:

- You want to call a **new endpoint** that is not yet supported by the SDK.
- You are using an **earlier version** of the SDK that doesn't support a particular endpoint, and can't update.
- You have a **custom endpoint** deployed that extends the <ProductName format={ProductNameFormat.ShortForm}/> API.

Comment thread
SoulPancake marked this conversation as resolved.
## Before you start

<SdkSetupPrerequisite />

## Making a request

Initialize the SDK client as usual (see [Setup SDK Client](../getting-started/setup-sdk-client.mdx)), then use the API Executor to build and send a request.

The examples below call a hypothetical custom endpoint (`/stores/{store_id}/custom-endpoint`), but you can use the same pattern for any <ProductName format={ProductNameFormat.ShortForm}/> API path.

### Calling a custom endpoint with POST

<ExecuteApiRequestViewer skipSetup={true} />

:::note
The examples above use `POST`, but the API Executor supports any HTTP method (`GET`, `POST`, `PUT`, `DELETE`, etc.). For `GET` requests, simply omit the `body` parameter.
:::

### Using path parameters

Path parameters are specified in the path using `{param_name}` syntax and must be provided via the path parameters option. They are URL-encoded automatically.

<ExecuteApiRequestPathParamsViewer skipSetup={true} />

### Decoding the response into a typed object

Some SDKs let you decode the raw response directly into a typed struct or class, avoiding manual JSON parsing.

<ExecuteApiRequestDecodeViewer skipSetup={true} />

## Streaming requests

For endpoints that stream results (such as `StreamedListObjects`), use the streaming variant of the API Executor. Streaming endpoints return results incrementally as they are computed, rather than waiting for all results before responding.

<ExecuteApiRequestStreamingViewer skipSetup={true} />

## Error handling

Always check the response status and handle errors appropriately. The API Executor preserves the SDK's built-in error handling, but you may want to inspect status codes for custom endpoints.

<ExecuteApiRequestErrorViewer skipSetup={true} />

## SDK examples

For complete working examples, refer to the API Executor examples in each SDK repository:

- [Node.js](https://github.com/openfga/js-sdk/tree/main/example/api-executor)
- [Go](https://github.com/openfga/go-sdk/tree/main/example/api_executor)
- [.NET](https://github.com/openfga/dotnet-sdk/tree/main/example/ApiExecutorExample)
- [Python](https://github.com/openfga/python-sdk/tree/main/example/execute-api-request)
- [Java](https://github.com/openfga/java-sdk/tree/main/examples/api-executor)

<RelatedSection
description="Check the following sections for more on how to interact with the API."
relatedLinks={[
{
title: 'Setup SDK Client for Store',
description: 'Learn how to initialize and configure the SDK client.',
link: '../getting-started/setup-sdk-client',
id: '../getting-started/setup-sdk-client.mdx',
},
{
title: 'Install SDK Client',
description: 'Learn how to install the OpenFGA SDK for your language.',
link: '../getting-started/install-sdk',
id: '../getting-started/install-sdk.mdx',
},
{
title: 'Relationship Queries',
description: 'An overview of Check, Read, Expand, and ListObjects APIs.',
link: '../interacting/relationship-queries',
id: '../interacting/relationship-queries.mdx',
},
]}
/>

5 changes: 5 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,11 @@ const sidebars = {
label: 'AuthZEN API',
id: 'content/interacting/authzen',
},
{
type: 'doc',
label: 'Calling Other Endpoints',
id: 'content/interacting/raw-api-requests',
},
],
},

Expand Down
Loading
Loading