blob: 9d4d480453658166017684f49fcf845a89865b2b [file] [log] [blame]
John Asmuth614db982014-04-24 15:46:26 -04001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="drive_v2.html">Drive API</a> . <a href="drive_v2.permissions.html">permissions</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#delete">delete(fileId, permissionId)</a></code></p>
79<p class="firstline">Deletes a permission from a file.</p>
80<p class="toc_element">
81 <code><a href="#get">get(fileId, permissionId)</a></code></p>
82<p class="firstline">Gets a permission by ID.</p>
83<p class="toc_element">
84 <code><a href="#getIdForEmail">getIdForEmail(email)</a></code></p>
85<p class="firstline">Returns the permission ID for an email address.</p>
86<p class="toc_element">
87 <code><a href="#insert">insert(fileId, body, sendNotificationEmails=None, emailMessage=None)</a></code></p>
88<p class="firstline">Inserts a permission for a file.</p>
89<p class="toc_element">
90 <code><a href="#list">list(fileId)</a></code></p>
91<p class="firstline">Lists a file's permissions.</p>
92<p class="toc_element">
Sai Cheemalapatidf613972016-10-21 13:59:49 -070093 <code><a href="#patch">patch(fileId, permissionId, body, removeExpiration=None, transferOwnership=None)</a></code></p>
Takashi Matsuo06694102015-09-11 13:55:40 -070094<p class="firstline">Updates a permission using patch semantics.</p>
John Asmuth614db982014-04-24 15:46:26 -040095<p class="toc_element">
Sai Cheemalapatidf613972016-10-21 13:59:49 -070096 <code><a href="#update">update(fileId, permissionId, body, removeExpiration=None, transferOwnership=None)</a></code></p>
John Asmuth614db982014-04-24 15:46:26 -040097<p class="firstline">Updates a permission.</p>
98<h3>Method Details</h3>
99<div class="method">
100 <code class="details" id="delete">delete(fileId, permissionId)</code>
101 <pre>Deletes a permission from a file.
102
103Args:
104 fileId: string, The ID for the file. (required)
105 permissionId: string, The ID for the permission. (required)
106</pre>
107</div>
108
109<div class="method">
110 <code class="details" id="get">get(fileId, permissionId)</code>
111 <pre>Gets a permission by ID.
112
113Args:
114 fileId: string, The ID for the file. (required)
115 permissionId: string, The ID for the permission. (required)
116
117Returns:
118 An object of the form:
119
120 { # A permission for a file.
121 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700122 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400123 "name": "A String", # The name for this permission.
124 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700125 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
126 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400127 "authKey": "A String", # The authkey parameter required for this permission.
128 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800129 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700130 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400131 "role": "A String", # The primary role for this user. Allowed values are:
132 # - owner
133 # - reader
134 # - writer
135 "type": "A String", # The account type. Allowed values are:
136 # - user
137 # - group
138 # - domain
139 # - anyone
140 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
141 "A String",
142 ],
143 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700144 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400145 }</pre>
146</div>
147
148<div class="method">
149 <code class="details" id="getIdForEmail">getIdForEmail(email)</code>
150 <pre>Returns the permission ID for an email address.
151
152Args:
153 email: string, The email address for which to return a permission ID (required)
154
155Returns:
156 An object of the form:
157
158 { # An ID for a user or group as seen in Permission items.
159 "kind": "drive#permissionId", # This is always drive#permissionId.
160 "id": "A String", # The permission ID.
161 }</pre>
162</div>
163
164<div class="method">
165 <code class="details" id="insert">insert(fileId, body, sendNotificationEmails=None, emailMessage=None)</code>
166 <pre>Inserts a permission for a file.
167
168Args:
169 fileId: string, The ID for the file. (required)
170 body: object, The request body. (required)
171 The object takes the form of:
172
173{ # A permission for a file.
174 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700175 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400176 "name": "A String", # The name for this permission.
177 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700178 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
179 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400180 "authKey": "A String", # The authkey parameter required for this permission.
181 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800182 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700183 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400184 "role": "A String", # The primary role for this user. Allowed values are:
185 # - owner
186 # - reader
187 # - writer
188 "type": "A String", # The account type. Allowed values are:
189 # - user
190 # - group
191 # - domain
192 # - anyone
193 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
194 "A String",
195 ],
196 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700197 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400198}
199
Craig Citro065b5302014-08-14 00:47:23 -0700200 sendNotificationEmails: boolean, Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the role is owner.
John Asmuth614db982014-04-24 15:46:26 -0400201 emailMessage: string, A custom message to include in notification emails.
202
203Returns:
204 An object of the form:
205
206 { # A permission for a file.
207 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700208 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400209 "name": "A String", # The name for this permission.
210 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700211 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
212 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400213 "authKey": "A String", # The authkey parameter required for this permission.
214 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800215 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700216 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400217 "role": "A String", # The primary role for this user. Allowed values are:
218 # - owner
219 # - reader
220 # - writer
221 "type": "A String", # The account type. Allowed values are:
222 # - user
223 # - group
224 # - domain
225 # - anyone
226 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
227 "A String",
228 ],
229 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700230 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400231 }</pre>
232</div>
233
234<div class="method">
235 <code class="details" id="list">list(fileId)</code>
236 <pre>Lists a file's permissions.
237
238Args:
239 fileId: string, The ID for the file. (required)
240
241Returns:
242 An object of the form:
243
244 { # A list of permissions associated with a file.
245 "items": [ # The actual list of permissions.
246 { # A permission for a file.
247 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700248 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400249 "name": "A String", # The name for this permission.
250 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700251 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
252 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400253 "authKey": "A String", # The authkey parameter required for this permission.
254 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800255 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700256 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400257 "role": "A String", # The primary role for this user. Allowed values are:
258 # - owner
259 # - reader
260 # - writer
261 "type": "A String", # The account type. Allowed values are:
262 # - user
263 # - group
264 # - domain
265 # - anyone
266 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
267 "A String",
268 ],
269 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700270 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400271 },
272 ],
273 "kind": "drive#permissionList", # This is always drive#permissionList.
274 "etag": "A String", # The ETag of the list.
275 "selfLink": "A String", # A link back to this list.
276 }</pre>
277</div>
278
279<div class="method">
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700280 <code class="details" id="patch">patch(fileId, permissionId, body, removeExpiration=None, transferOwnership=None)</code>
Takashi Matsuo06694102015-09-11 13:55:40 -0700281 <pre>Updates a permission using patch semantics.
John Asmuth614db982014-04-24 15:46:26 -0400282
283Args:
284 fileId: string, The ID for the file. (required)
285 permissionId: string, The ID for the permission. (required)
286 body: object, The request body. (required)
287 The object takes the form of:
288
289{ # A permission for a file.
290 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700291 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400292 "name": "A String", # The name for this permission.
293 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700294 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
295 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400296 "authKey": "A String", # The authkey parameter required for this permission.
297 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800298 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700299 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400300 "role": "A String", # The primary role for this user. Allowed values are:
301 # - owner
302 # - reader
303 # - writer
304 "type": "A String", # The account type. Allowed values are:
305 # - user
306 # - group
307 # - domain
308 # - anyone
309 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
310 "A String",
311 ],
312 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700313 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400314}
315
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700316 removeExpiration: boolean, Whether to remove the expiration date.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000317 transferOwnership: boolean, Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.
John Asmuth614db982014-04-24 15:46:26 -0400318
319Returns:
320 An object of the form:
321
322 { # A permission for a file.
323 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700324 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400325 "name": "A String", # The name for this permission.
326 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700327 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
328 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400329 "authKey": "A String", # The authkey parameter required for this permission.
330 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800331 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700332 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400333 "role": "A String", # The primary role for this user. Allowed values are:
334 # - owner
335 # - reader
336 # - writer
337 "type": "A String", # The account type. Allowed values are:
338 # - user
339 # - group
340 # - domain
341 # - anyone
342 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
343 "A String",
344 ],
345 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700346 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400347 }</pre>
348</div>
349
350<div class="method">
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700351 <code class="details" id="update">update(fileId, permissionId, body, removeExpiration=None, transferOwnership=None)</code>
John Asmuth614db982014-04-24 15:46:26 -0400352 <pre>Updates a permission.
353
354Args:
355 fileId: string, The ID for the file. (required)
356 permissionId: string, The ID for the permission. (required)
357 body: object, The request body. (required)
358 The object takes the form of:
359
360{ # A permission for a file.
361 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700362 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400363 "name": "A String", # The name for this permission.
364 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700365 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
366 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400367 "authKey": "A String", # The authkey parameter required for this permission.
368 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800369 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700370 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400371 "role": "A String", # The primary role for this user. Allowed values are:
372 # - owner
373 # - reader
374 # - writer
375 "type": "A String", # The account type. Allowed values are:
376 # - user
377 # - group
378 # - domain
379 # - anyone
380 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
381 "A String",
382 ],
383 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700384 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400385}
386
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700387 removeExpiration: boolean, Whether to remove the expiration date.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000388 transferOwnership: boolean, Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.
John Asmuth614db982014-04-24 15:46:26 -0400389
390Returns:
391 An object of the form:
392
393 { # A permission for a file.
394 "withLink": True or False, # Whether the link is required for this permission.
Craig Citro065b5302014-08-14 00:47:23 -0700395 "domain": "A String", # The domain name of the entity this permission refers to. This is an output-only field which is present when the permission type is user, group or domain.
John Asmuth614db982014-04-24 15:46:26 -0400396 "name": "A String", # The name for this permission.
397 "kind": "drive#permission", # This is always drive#permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700398 "value": "A String", # The email address or domain name for the entity. This is used during inserts and is not populated in responses. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
399 "id": "A String", # The ID of the user this permission refers to, and identical to the permissionId in the About and Files resources. When making a drive.permissions.insert request, exactly one of the id or value fields must be specified unless the permission type anyone, in which case both id and value are ignored.
John Asmuth614db982014-04-24 15:46:26 -0400400 "authKey": "A String", # The authkey parameter required for this permission.
401 "etag": "A String", # The ETag of the permission.
Craig Citroe633be12015-03-02 13:40:36 -0800402 "emailAddress": "A String", # The email address of the user or group this permission refers to. This is an output-only field which is present when the permission type is user or group.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700403 "expirationDate": "A String", # The time at which this permission will expire (RFC 3339 date-time).
John Asmuth614db982014-04-24 15:46:26 -0400404 "role": "A String", # The primary role for this user. Allowed values are:
405 # - owner
406 # - reader
407 # - writer
408 "type": "A String", # The account type. Allowed values are:
409 # - user
410 # - group
411 # - domain
412 # - anyone
413 "additionalRoles": [ # Additional roles for this user. Only commenter is currently allowed.
414 "A String",
415 ],
416 "selfLink": "A String", # A link back to this permission.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700417 "photoLink": "A String", # A link to the profile photo, if available.
John Asmuth614db982014-04-24 15:46:26 -0400418 }</pre>
419</div>
420
421</body></html>