# Basic API Requests for v2

**URL:** <https://community.bluescape.com/t/basic-api-requests-for-v2/2144>\
**Category:** Developer\
**Tags:** api\
**Created:** [July 26, 2022, 6:45pm UTC](https://community.bluescape.com/t/basic-api-requests-for-v2/2144 "2022-07-26T18:45:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Garrett](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@Tom\_Garrett](https://community.bluescape.com/u/Tom_Garrett)\
**Post date:** [July 26, 2022, 6:45pm UTC](https://community.bluescape.com/t/basic-api-requests-for-v2/2144/1 "2022-07-26T18:45:21Z")

</div>

| **Important Notice** |
| --- |
| Bluescape is in the process of decommissioning public v2 APIs. |
| As part of this process, this guide will be removed from the Community at the time of the August 2023 Release. To prepare for this, visit the [Basic API Requests](https://community.bluescape.com/t/basic-api-requests/2022) topic to familiarize yourself with the v3 API process. |

_This guide assumes you have obtained an access token from an authorized user. You can obtain an access token by completing the OAuth flow see the [Application Authorization](https://community.bluescape.com/t/application-authorization/2025)._

This page contains the details for v2 REST APIs. You can also see the guide for [v3 REST APIs](https://community.bluescape.com/t/basic-api-requests/2022#implementation-using-rest-apis-3) and for [v3 GraphQL APIs](https://community.bluescape.com/t/basic-api-requests/2022#implementation-using-v3-graphql-apis-8).

### The Base URL

All API endpoints share the same base URL whether you are trying to access them through REST or GraphQL methods:

```auto
https://api.apps.us.bluescape.com

```

#### Authorization Header

All operations whether REST or GraphQL require an **Authorization** header based on the access tokens received from the OAuth flow. The value of this header should match the format of `Bearer <access-token>`.

## Implementation using REST APIs

### Assembling a REST Request

#### URL

A request URL is assembled from the base URL and the **path** information for an operation as found in the reference. For example, Add a User to an Organization is an operation with path `/organizations/<organizationId>/users`. Combining this path with the base URL gives us a request URL of:

```auto
https://api.apps.us.bluescape.com/v2/organizations/<organizationId>/users

```

#### Parameters

The path for the operation above, like many in the Bluescape API, contains a parameter. Adding a user to an organization requires we identify the organization to which the new user should be invited. To finish preparing this request URL, we must replace `<organizationId>` with a valid organization ID, such as one obtained from the List a User’s Organizations operation. Replacing the parameter placeholder with a sample organization ID yields a request URL of:

```auto
https://api.apps.us.bluescape.com/v2/organizations/eidzMVOsv4peKG-4DLKA/users

```

In addition to path parameters, some requests will have query, body and form data parameters. Reviewing the documentation for Add a User to an Organization, we see that this operation has a JSON-format body parameter, with required `id`, `type` and `organizationRoleId` fields. When an operation requires a body parameter, be sure to send your request with a `Content-Type` header of `application/json`. When a form data parameter is expected, be sure to send your request with a `Content-Type` header of `multipart/form-data`. A valid body for this request looks like:

```auto
{
  "id": "<SET_USER_ID>",
  "type": "<SET_MEMBER_TYPE>", #example: User
  "organizationRoleId": "<SET_ORGANIZATION_ROLE_ID>"
}

```

#### Assembled Request

Putting this all together, a request to Add a User to an Organization looks like:

> **cURL**
>
> ```auto
> curl -X POST https://api.apps.us.bluescape.com/v2/organizations/<SET_ORGANIZATION_ID>/users \
> -H 'Authorization: Bearer <SET_TOKEN>' \
> -H 'Content-Type: application/json' \
> -d '{
> "id": "<SET_USER_ID>",
> "type": "<SET_MEMBER_TYPE>", #example: User
> "organizationRoleId": "<SET_ORGANIZATION_ROLE_ID>"
> }'
> 
> ```

> **Python**
>
> ```auto
> import requests
> import pprint 
> 
> portal = 'https://api.apps.us.bluescape.com'
> organizationId = '<SET_ORGANIZATION_ID>';
> API_version = 'v2'
> API_endpoint = '/' + API_version + '/organizations/' + organizationId + '/users'
> token = '<SET_TOKEN>';
> data_load = {
> "id": "<SET_USER_ID>",
> "type": "<SET_MEMBER_TYPE>", #example: User
> "organizationRoleId": "<SET_ORGANIZATION_ROLE_ID>"
> }
> 
> the_request = requests.post(
> portal+API_endpoint,
> headers={"Authorization": "Bearer " + token,
> "Content-Type": "application/json"
> },
> json=data_load
> )
> 
> json_response = the_request.json()
> pprint.pprint(json_response)
> 
> ```

 

> # Where to Next?
> 
> - [Get the list of your workspaces for v3](https://community.bluescape.com/t/wip-get-the-list-of-your-workspaces-for-v3/2027)
> - [Bluescape API Guides](https://community.bluescape.com/t/bluescape-api-guides-landing-page/2020)
> - [Bluescape API Overview](https://community.bluescape.com/t/wip-bluescape-api-overview/2021/2)
> - [Latest Developer topics](https://community.bluescape.com/c/developer/14)
> 
> **Not what you were looking for? Reply below or [Search](https://community.bluescape.com/search) the community and discover more Bluescape.**

---

<div class="post-metadata">

**Author:** ![rorycb](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rorycb](https://community.bluescape.com/u/rorycb)\
**Post date:** [November 7, 2023, 8:36pm UTC](https://community.bluescape.com/t/basic-api-requests-for-v2/2144/2 "2023-11-07T20:36:28Z")

</div>

Closed on November 7, 2023, 8:36pm UTC



---

<div class="post-metadata">

**Author:** ![rorycb](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@rorycb](https://community.bluescape.com/u/rorycb)\
**Post date:** [November 7, 2023, 8:36pm UTC](https://community.bluescape.com/t/basic-api-requests-for-v2/2144/3 "2023-11-07T20:36:33Z")

</div>

Unlisted on November 7, 2023, 8:36pm UTC


