Skip to content

Commit

Permalink
Merge pull request #1006 from programaths/main
Browse files Browse the repository at this point in the history
Update permission-grant.md
  • Loading branch information
jasonjoh authored Aug 10, 2023
2 parents 687551c + 4180d4d commit 0d60cc1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions api-reference/v1.0/api/permission-grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ One of the following permissions is required to call this API. To learn more, in
POST /shares/{encoded-sharing-url}/permission/grant
```

### Path parameters

| Parameter Name | Value | Description |
|:-------------------------------|:---------|:------------------------------------------------------------------------------------|
| **encoded-sharing-url** | `string` | Required. A properly encoded sharing URL. |

### Encoding sharing URLs

To encode a sharing URL, use the following logic:

1. First, use base64 encode the URL.
2. Convert the base64 encoded result to [unpadded base64url format](https://en.wikipedia.org/wiki/Base64) by removing `=` characters
from the end of the value, replacing `/` with `_` and `+` with `-`.)
3. Append `u!` to be beginning of the string.

As an example, to encode a URL in C#:

```csharp
string sharingUrl = "https://onedrive.live.com/redir?resid=1231244193912!12&authKey=1201919!12921!1";
string base64Value = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(sharingUrl));
string encodedUrl = "u!" + base64Value.TrimEnd('=').Replace('/','_').Replace('+','-');
```

## Request headers

| Name | Description |
Expand Down

0 comments on commit 0d60cc1

Please sign in to comment.