Skip to content

Commit

Permalink
Use EndpointRequestSnippet / EndpointResponseSnippet
Browse files Browse the repository at this point in the history
  • Loading branch information
ucarion committed Sep 4, 2024
1 parent 2904b65 commit 5ed7278
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 128 deletions.
25 changes: 24 additions & 1 deletion fern/openapi-overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,31 @@ paths:
x-fern-sdk-group-name: scim
x-fern-sdk-method-name: listSCIMUsers
x-fern-examples:
- query-parameters:
- name: List Users
query-parameters:
organizationExternalId: my_custom_external_id
response:
body:
scimUsers:
- id: scim_user_...
email: [email protected]
deleted: false
attributes:
displayName: John Doe
preferredLanguage: en_US
key: value
- id: scim_user_...
email: [email protected]
deleted: true
attributes:
displayName: Jane Doe
preferredLanguage: fr_FR
key: value
nextPageToken: "..."
- name: Filter Users by Group ID
query-parameters:
organizationExternalId: my_custom_external_id
scimGroupId: scim_group_...
response:
body:
scimUsers:
Expand Down
32 changes: 2 additions & 30 deletions fern/pages/saml-logins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,12 @@ https://yourcompany.com/ssoready-callback?saml_access_code=saml_access_code_...
Your backend then exchanges that SAML access code for details about the user
logging in:

<CodeBlocks>
<EndpointRequestSnippet endpoint="POST /v1/saml/redeem" />

```bash title="cURL"
curl https://api.ssoready.com/v1/saml/redeem \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..." \
-d '{ "samlAccessCode": "saml_access_code_..." }'
```

```typescript title="TypeScript"
const ssoready = new SSOReadyClient();
await ssoready.saml.redeemSamlAccessCode({
samlAccessCode: "saml_access_code_...",
});
```

```python title="Python"
client = SSOReady()
client.saml.redeem_saml_access_code(
saml_access_code="saml_access_code_...",
)
```

</CodeBlocks>

You'll get back details about user that look like this:

```json
{
"email": "[email protected]",
"organizationId": "org_7cu5hsy9vrbi5d2k1qvbh19lj",
"organizationExternalId": "my_custom_external_id"
}
```
<EndpointResponseSnippet endpoint="POST /v1/saml/redeem" />

The rest of this document is about where you go from here.

Expand Down
27 changes: 3 additions & 24 deletions fern/pages/saml-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,9 @@ So what you'll need to do is create a new "SSOReady callback page" (typically so
`https://app.yourcompany.com/ssoready-callback`), where you'll expect a `?saml_access_code=saml_access_code_...` query parameter in the URL.
From your backend, you'll exchange that access code for a user's details:

<CodeBlocks>

```bash cURL
curl https://api.ssoready.com/v1/saml/redeem \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..." \
-d '{ "samlAccessCode": "saml_access_code_..." }'
```

```typescript title="TypeScript"
const ssoready = new SSOReadyClient();
await ssoready.saml.redeemSamlAccessCode({
samlAccessCode: "saml_access_code_...",
});
```

```python title="Python"
client = SSOReady()
client.saml.redeem_saml_access_code(
saml_access_code="saml_access_code_...",
)
```

</CodeBlocks>
<EndpointRequestSnippet endpoint="POST /v1/saml/redeem" />
<EndpointResponseSnippet endpoint="POST /v1/saml/redeem" />


The response will include the user's `email` as well as the SSOReady `organizationId` and `organizationExternalId`
they belong to. It's your responsibility to then log the user in with that given email and organization using whatever
Expand Down
80 changes: 7 additions & 73 deletions fern/pages/scim-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,50 +55,22 @@ that your customer populates. To sync users, you'll:

To list SCIM users out of SSOReady, run:

```bash
curl 'https://api.ssoready.com/v1/scim/users?organization_external_id=...' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..."
```
<EndpointRequestSnippet endpoint="GET /v1/scim/users" />

That code sample requires an API Key (`ssoready_sk_...`) and an
`organization_external_id`. How you get those is covered in [Setting up
SSOReady](#setting-up-ssoready) later on this page.

You'll get back a response that looks like this:

```json
{
"users": [
{
"id": "scim_user_...",
"email": "[email protected]",
"deleted": false,
"attributes": {}
},
{
"id": "scim_user_...",
"email": "[email protected]",
"deleted": true,
"attributes": {}
}
],
"nextPageToken": "..."
}
```
<EndpointResponseSnippet endpoint="GET /v1/scim/users" />

If the response contains a `nextPageToken` whose value is empty (i.e. the empty
string, `""`), then you have reached the end of the list.

If `nextPageToken` is non-empty, there is more data to fetch. You can fetch the
next page of data by re-running your previous request, but setting the parameter
`pageToken` to the value of `nextPageToken` you just got back:

```bash
curl 'https://api.ssoready.com/v1/scim/users?organization_external_id=...&page_token=...' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..."
```
`pageToken` to the value of `nextPageToken` you just got back.

### Provisioning (creating) users

Expand Down Expand Up @@ -240,52 +212,18 @@ group-specific concept.

To list SCIM groups out of SSOReady, run:

```bash
curl 'https://api.ssoready.com/v1/scim/groups?organization_external_id=...' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..."
```
<EndpointRequestSnippet endpoint="GET /v1/scim/groups" />

You'll get back a response that looks like this:

```json
{
"scimGroups": [
{
"id": "scim_group_...",
"scimDirectoryId": "scim_directory_...",
"displayName": "Engineering",
"deleted": false,
"attributes": {
"displayName": "Engineering"
}
},
{
"id": "scim_group_...",
"scimDirectoryId": "scim_directory_...",
"displayName": "Marketing",
"deleted": true,
"attributes": {
"displayName": "Marketing"
}
}
],
"nextPageToken": "..."
}
```
<EndpointResponseSnippet endpoint="GET /v1/scim/groups" />

If the response contains a `nextPageToken` whose value is empty (i.e. the empty
string, `""`), then you have reached the end of the list.

If `nextPageToken` is non-empty, there is more data to fetch. You can fetch the
next page of data by re-running your previous request, but setting the parameter
`page_token` to the value of `nextPageToken` you just got back:

```bash
curl 'https://api.ssoready.com/v1/scim/groups?organization_external_id=...&page_token=...' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..."
```
`page_token` to the value of `nextPageToken` you just got back.

### Provisioning (creating) groups

Expand Down Expand Up @@ -350,11 +288,7 @@ To list users that are members of a group, you can provide a `scim_group_id`
parameter when listing SCIM users, using the same method as documented in
[Listing users](#listing-users) above:

```bash
curl 'https://api.ssoready.com/v1/scim/users?organization_external_id=...&scim_group_id=scim_group_...' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ssoready_sk_..."
```
<EndpointRequestSnippet endpoint="GET /v1/scim/users" example="Filter Users by Group ID" />

You need to provide the SSOReady-assigned `id` for the SCIM Group, beginning
with `scim_group_...`, as the `scim_group_id`.
Expand Down

0 comments on commit 5ed7278

Please sign in to comment.