|
1 | 1 | # Web Links
|
2 | 2 |
|
3 |
| -Web link objects represent a web link (bookmark) from a user's account. They can perform common web link operations, like create, read, update, and delete. |
| 3 | +Represents a web link (bookmark) on Box |
4 | 4 |
|
5 | 5 | ## Get a Web Link's Information
|
6 | 6 |
|
7 |
| -Calling `getWebLinkInfo()` on a web link returns a snapshot of the web link's info. |
8 |
| - |
9 | 7 | ```java
|
10 | 8 | BoxWebLink webLink = new BoxWebLink(api, 'web-link-id');
|
11 | 9 | BoxWebLink.Info info = webLink.getWebLinkInfo();
|
12 | 10 | ```
|
13 | 11 |
|
14 |
| -## Update a Web Link's Information |
| 12 | +## Create a Web Link |
| 13 | + |
| 14 | +```java |
| 15 | +BoxWebLink webLink = new BoxWebLink(api, null); |
| 16 | +BoxWebLink.Info info = new BoxWebLink.Info('{"url":"https://www.salesforce.com/", "parent": {"id": "0"}, "name": "Salesforce", "description": "Link to Salesforce"}'); |
| 17 | +BoxWebLink.Info created = webLink.createWebLink(info); |
| 18 | +``` |
15 | 19 |
|
16 |
| -Updating a web link's information is done by creating a new `BoxWebLink.Info` object or updating an existing one, and then calling `updateWebLinkInfo(BoxWebLink.Info)`. |
| 20 | +## Update a Web Link's Information |
17 | 21 |
|
18 | 22 | ```java
|
19 |
| -BoxWebLink webLink = new BoxWebLink(api, '12303730068'); |
| 23 | +BoxWebLink webLink = new BoxWebLink(api, 'web-link-id'); |
20 | 24 | BoxWebLink.Info info = webLink.getWebLinkInfo();
|
21 |
| -info.addValue('description', 'Some web link I made'); |
| 25 | +info.addValue('description', 'a descriptive description'); |
22 | 26 | BoxWebLink.Info updated = webLink.updateWebLinkInfo(info);
|
23 | 27 | ```
|
24 | 28 |
|
25 | 29 | ## Delete a Web Link
|
26 | 30 |
|
27 |
| -A web link can be deleted with the `deleteWebLink()` method. |
28 |
| - |
29 | 31 | ```java
|
30 | 32 | BoxWebLink webLink = new BoxWebLink(api, 'web-link-id');
|
31 | 33 | webLink.deleteWebLink();
|
32 | 34 | ```
|
| 35 | + |
| 36 | +## Get a Trashed Web Link's Information |
| 37 | + |
| 38 | +```java |
| 39 | +BoxWebLink webLink = new BoxWebLink(api, 'web-link-id'); |
| 40 | +BoxWebLink.Info info = webLink.getTrashedWebLinkInfo(); |
| 41 | +``` |
| 42 | + |
| 43 | +## Restore a Trashed Web Link |
| 44 | + |
| 45 | +```java |
| 46 | +BoxWebLink webLink = new BoxWebLink(api, 'web-link-id'); |
| 47 | +BoxWebLink.Info info = webLink.restoreTrashedWebLink(); |
| 48 | +``` |
| 49 | + |
| 50 | +## Permanently Delete a Web Link |
| 51 | + |
| 52 | +```java |
| 53 | +BoxWebLink webLink = new BoxWebLink(api, 'web-link-id'); |
| 54 | +webLink.permanentlyDeleteWebLink(); |
| 55 | +``` |
0 commit comments