# create\_edit\_url()

## Create a edit url

&#x20; <mark style="background-color:orange;">create\_edit\_url()</mark> &#x20;

Create an url to an editable view of the file. By default, a public shared link will be created.

{% tabs %}
{% tab title="OneDrive" %}
{% hint style="info" %}
**OneDrive Premium** and **Business** accounts can request an expiring shared link or set a password.
{% endhint %}

### **Parameters**

<table><thead><tr><th width="196">Name</th><th width="87">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$id</code></td><td>string</td><td>ID of the entry</td></tr><tr><td><code>$param</code></td><td>array</td><td><p>Additional sharing permissions. Defaults to:</p><pre class="language-json"><code class="lang-json">$param = [
  'type' => 'edit',
  'scope' => 'anonymous',
];
</code></pre></td></tr></tbody></table>

### **Return**

<table><thead><tr><th width="194">Name</th><th width="238">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$url</code></td><td>string</td><td>The created link</td></tr></tbody></table>

### **Usage**

```php
WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');

$params = [
    'type' => 'edit',
    'scope' => 'anonymous',
];

// Set password
// !!! Only available for OneDrive Business
$params['password'] = 'mypass1234';

// Set expire date
// !!! Only available for OneDrive Business
$expire_date = current_datetime()->modify('+1 month');
$params['unshared_at'] = $expire_date->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d\TH:i:s\Z');

// Create / Get shared links
$url = WPCP_ONEDRIVE_API::create_edit_url('01EXLSWHWMQZNDMLRG7NFIWAVYCFJAXP2R', $params);
```

{% endtab %}

{% tab title="Google Drive" %}

### **Parameters**

<table><thead><tr><th width="196">Name</th><th width="87">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$id</code></td><td>string</td><td>ID of the entry</td></tr><tr><td><code>$params</code></td><td>array</td><td><p>Additional params for sharing permissions. Default: </p><pre class="language-json"><code class="lang-json">$param = [
    'role' => 'reader',
];
</code></pre></td></tr></tbody></table>

### **Return**

<table><thead><tr><th width="194">Name</th><th width="238">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>$url</code></td><td>string</td><td>The created link</td></tr></tbody></table>

### **Usage**

```php
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')

$params = [
  'role' => 'writer'
];

// Get edit url and update sharing permissions
$edit_url = WPCP_GDRIVE_API::create_edit_url('1wzWlDMsZkA4N5yEEAmMigp52u7M0Lk_7', $params);
```

{% endtab %}

{% tab title="Dropbox" %}
{% hint style="info" %}

#### **Not supported.**

{% endhint %}
{% endtab %}

{% tab title="Box" %}
{% hint style="info" %}
**Not supported.**
{% endhint %}
{% endtab %}
{% endtabs %}
