ウェブリンクを作成

post
https://api.box.com/2.0
/web_links

フォルダ内にウェブリンクオブジェクトを作成します。

リクエスト

application/json

リクエスト本文

string本文内省略可能
Cloud Content Management

ウェブリンクの説明。

string本文内省略可能
Box Website

ウェブリンクの名前。設定されてない場合は、デフォルトでURLに設定されます。

object本文内

ウェブリンクの作成先となる親フォルダ。

stringnull省略可能
0

親フォルダのID

string本文内必須
https://box.com

このウェブリンクのリンク先となるURL。"http://"または"https://"で始まっている必要があります。

レスポンス

application/jsonウェブリンク

新しく作成されたウェブリンクオブジェクトを返します。

予期しないクライアントエラー。

post
ウェブリンクを作成
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -X POST https://api.box.com/2.0/web_links \
     -H 'Authorization: Bearer <ACCESS_TOKEN>" '
     -H 'Content-Type: application/json" '
     -d '{
       "name": "Cloud Content Management",
       "url": "https://box.com",
       "parent": {
         "id": "0"
       }
     }'
.NET
var weblinkParams = new BoxWebLinkRequest()
{
    Url = new Uri("http://www.example.com"),
    Parent = new BoxRequestEntity()
    {
        Id = "22222"
    }
};
BoxWebLink link = await client.WebLinksManager.CreateWebLinkAsync(weblinkParams);
Java
BoxFolder folder = new BoxFolder(api, id);
URL url = new URL("https://www.example.com");
folder.createWebLink("Link to Example", url, "This goes to an example page");
Python
web_link = client.folder(folder_id='12345').create_web_link('https://example.com', 'Example Link', 'This is the description')
print('Web Link url is {0} and its description is {1}'.format(web_link.url, web_link.description))
Node
client.weblinks.create(
	'https://www.box.com',
	'22222',
	{
		name: 'Box Website!',
		description: 'Cloud Content Management'
	})
	.then(weblink => {
		/* weblink -> {
			type: 'web_link',
			id: '11111',
			sequence_id: '0',
			etag: '0',
			name: 'Box Website!',
			url: 'https://www.box.com',
			created_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			created_at: '2015-05-07T15:00:01-07:00',
			modified_at: '2015-05-07T15:00:01-07:00',
			parent: 
			{ type: 'folder',
				id: '22222',
				sequence_id: '1',
				etag: '1',
				name: 'Bookmarks' },
			description: 'Enterprise Cloud Content Management',
			item_status: 'active',
			trashed_at: null,
			purged_at: null,
			shared_link: null,
			path_collection: 
			{ total_count: 2,
				entries: 
				[ { type: 'folder',
					id: '0',
					sequence_id: null,
					etag: null,
					name: 'All Files' },
					{ type: 'folder',
					id: '22222',
					sequence_id: '1',
					etag: '1',
					name: 'Bookmarks' } ] },
			modified_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			owned_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' } }
		*/
	});