> For the complete documentation index, see [llms.txt](https://docs.ebbot.ai/ebbot-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ebbot.ai/ebbot-docs/core-capabilities/ebbotgpt/ebbotgpt-knowledge/source-types/api-sources/sharepoint-api/guide-import-and-use-postman-collection.md).

# Guide: Import And Use Postman Collection

### **What is Postman?**&#x20;

**Postman** is a popular tool used by developers to design, test, and document APIs. It simplifies API testing with an intuitive interface, allowing users to send requests, inspect responses, and automate testing. It is widely used for its efficiency and ease of use in managing and debugging APIs.

Please note that you may need to create an account to use Postman. This guide and collection prioritize ease of use and importability, but you can make the same calls with any other preferred API management tool. Download Postman [here](https://www.postman.com/).

### Collection of API calls and setting variables

{% file src="/files/Lc9pcf9Ux0WeWRAYqydF" %}
Import this collection into your Postman instance
{% endfile %}

We have created a collection that contains all the necessary calls needed to set up the permissions, you will need to configure the variables to match with your apps credentials:&#x20;

<figure><img src="https://2117387010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3rWESGvwA3vHJ3zNiAG1%2Fuploads%2FmgsHyjtorAIJBw0Yu2aF%2Fimage.png?alt=media&amp;token=3aecc1f3-108c-4d77-9092-5252e268755e" alt=""><figcaption></figcaption></figure>

Start by navigating to the top of the collection "Microsoft Graph (Sharepoint)" and select the "Variables" tab. By default, you will see whats on the image above. You will also see a column for "Current value". This is where you want to add the credentials.

* client\_id - Application (client) ID
* client\_secret - Secret **value** for full control app
* ebbot\_app\_id - Found on the authentication modal in Ebbot
* tenantId - Directory (tenant) ID

<figure><img src="https://2117387010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3rWESGvwA3vHJ3zNiAG1%2Fuploads%2FuRuMDQjGfTWFCEY1g1sk%2Fimage.png?alt=media&amp;token=e6ca5bf8-109d-4592-9794-e248d9cac98c" alt=""><figcaption><p>You will find the ebbot_app_id on the Sharepoint connection modal</p></figcaption></figure>

These are the initial credentials you'll need. They can be found by going to portal.azure.com -> App registrations -> Your Full control app page overview - with the exception of client\_secret which can be found under Certificates & secrets on the same page.

Once filled, navigate to the "FullControl app token request" call in Postman\
Sending the call will generate a jwt token and automatically set it in the jwt\_token variable. This token is needed for the following operations, searching sites and granting permissions.&#x20;

### Finding siteId's

Next step is to find the sites you want to grant permissions to. This can be done in different ways, the postman collection has two methods of doing it:&#x20;

#### Get All Sites

This call returns a list of all sites in the SharePoint environment. The response can be long and it may be hard to find the relevant sites here as it will return everything.&#x20;

```
GET https://graph.microsoft.com/v1.0/sites/getAllSites
```

#### Search sites

Another method is to search among the sites, this should be easier to use and return the specific sites you search for, for example display name of the site.

```
GET https://graph.microsoft.com/v1.0/sites?search=your search string
```

<figure><img src="https://2117387010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3rWESGvwA3vHJ3zNiAG1%2Fuploads%2FoIPIiIqvAjymSLUDRtyy%2Fimage.png?alt=media&amp;token=6fb5bcbf-3efc-4462-9205-43e116449f7b" alt=""><figcaption></figcaption></figure>

#### Grabbing the ID

Regardless of which method is used, the siteId is needed to both grant permissions for Ebbot, but also to provide inside ebbot app. When you find the sites you want to allow, save the full string of the "id" field in the response into a note, you will need to make a separate call **for each id** and also add them in Ebbot later.

**SiteID example format:**

```
helloebbot.sharepoint.com,47772730-ca4f-4ff0-95a0-f4f5e9ea01d3,d16f172a-26ba-4c24-ac75-e3b25a28dfac
```

{% hint style="info" icon="lightbulb" %}
Note that the SiteIDs are unique strings that include your domain and two separate IDs separated by commas: ***"domain.sharepoint.com,GUID,GUID".*** Make sure you enter the full siteID strings.
{% endhint %}

### Granting read permissions

When you have a list of IDs of the sites you want to fetch into Ebbot, its time to run the "Set permissions to sites" call in postman, for each siteId you have stored.&#x20;

<pre><code>POST https://graph.microsoft.com/v1.0/sites/<a data-footnote-ref href="#user-content-fn-1">{{siteId}}</a>/permissions
</code></pre>

Replace {{siteId}} with the full id and send the request - the response will display which roles have been set, which is "read" in this postman collection:\
![](https://2117387010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3rWESGvwA3vHJ3zNiAG1%2Fuploads%2F47txoXbAlp5Zs489SlSo%2Fimage.png?alt=media\&token=b20cec81-fdf3-4b7d-9425-789a7687ad92)

Repeat the above step for each site you want to grant permissions to. You should then be ready to create a new source using SharePoint API in the Ebbot platform.&#x20;

<figure><img src="https://2117387010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3rWESGvwA3vHJ3zNiAG1%2Fuploads%2F4leOCBRdtpctnIDpYDuz%2Fimage.png?alt=media&amp;token=1e319b44-8aec-4cd2-8ccc-2d2bbd539998" alt=""><figcaption></figcaption></figure>

[^1]: This should match the SiteID format above
