forked from Esri/portalpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
portalpy.html
616 lines (576 loc) · 61.6 KB
/
portalpy.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module PortalPy</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>PortalPy</strong></big></big> (version 1.0)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:///C:/portalpy/portalpy.py">c:\portalpy\portalpy.py</a></font></td></tr></table>
<p><tt>The portalpy module for working with the ArcGIS Online and <a href="#Portal">Portal</a> APIs.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="collections.html">collections</a><br>
<a href="copy.html">copy</a><br>
<a href="gzip.html">gzip</a><br>
<a href="httplib.html">httplib</a><br>
</td><td width="25%" valign=top><a href="imghdr.html">imghdr</a><br>
<a href="json.html">json</a><br>
<a href="logging.html">logging</a><br>
<a href="mimetools.html">mimetools</a><br>
</td><td width="25%" valign=top><a href="mimetypes.html">mimetypes</a><br>
<a href="os.html">os</a><br>
<a href="re.html">re</a><br>
<a href="tempfile.html">tempfile</a><br>
</td><td width="25%" valign=top><a href="unicodedata.html">unicodedata</a><br>
<a href="urllib.html">urllib</a><br>
<a href="urllib2.html">urllib2</a><br>
<a href="urlparse.html">urlparse</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="PortalPy.html#Portal">Portal</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Portal">class <strong>Portal</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>An <a href="__builtin__.html#object">object</a> representing a connection to a single portal (via URL).<br>
<br>
Notes:<br>
<br>
To instantiate a <a href="#Portal">Portal</a> <a href="__builtin__.html#object">object</a> execute code like this: <br>
<br>
PortalPy.<a href="#Portal">Portal</a>(portalUrl, user, password)<br>
<br>
There are a few things you should know as you use the methods below.<br>
<br>
Group IDs<br>
Many of the group functions require a group id. This id is<br>
different than the group's name or title. To determine<br>
a group id, use the search_groups function using the title<br>
to get the group id.<br>
<br>
Time<br>
Many of the methods return a time field. All time is<br>
returned as millseconds since 1 January 1970. Python<br>
expects time in seconds since 1 January 1970 so make sure<br>
to divide times from PortalPy by 1000. See the example<br>
a few lines down to see how to convert from PortalPy time<br>
to Python time.<br>
<br>
<br>
Example - converting time<br>
import time<br>
.<br>
.<br>
.<br>
group = portalAdmin.<a href="#Portal-get_group">get_group</a>('67e1761068b7453693a0c68c92a62e2e')<br>
pythontime = time.ctime(group['created']/1000)<br>
<br>
<br>
Example - list users in group <br>
portal = PortalPy.<a href="#Portal">Portal</a>(portalUrl, user, password)<br>
resp = portal.<a href="#Portal-get_group_members">get_group_members</a>('67e1761068b7453693a0c68c92a62e2e')<br>
for user in resp['users']:<br>
print user<br>
<br>
Example - create a group<br>
portal= PortalPy.<a href="#Portal">Portal</a>(portalUrl, user, password)<br>
group_id = portalAdmin.<a href="#Portal-create_group">create_group</a>('my group', 'test tag', 'a group to share travel maps')<br>
<br>
Example - delete a user named amy and assign her content to bob<br>
portal= PortalPy.<a href="#Portal">Portal</a>(portalUrl, user, password)<br>
portal.<a href="#Portal-delete_user">delete_user</a>('amy.user', True, 'bob.user')<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Portal-__init__"><strong>__init__</strong></a>(self, url, username<font color="#909090">=None</font>, password<font color="#909090">=None</font>, key_file<font color="#909090">=None</font>, cert_file<font color="#909090">=None</font>, expiration<font color="#909090">=60</font>, referer<font color="#909090">=None</font>, proxy_host<font color="#909090">=None</font>, proxy_port<font color="#909090">=None</font>, connection<font color="#909090">=None</font>, workdir<font color="#909090">=r'c:\users\davi3690\appdata\local\temp\2'</font>)</dt><dd><tt>The <a href="#Portal">Portal</a> constructor. Requires URL and optionally username/password.</tt></dd></dl>
<dl><dt><a name="Portal-add_group_users"><strong>add_group_users</strong></a>(self, user_names, group_id)</dt><dd><tt>Adds users to the group specified. <br>
<br>
Note:<br>
This method will only work if the user for the<br>
<a href="#Portal">Portal</a> <a href="__builtin__.html#object">object</a> is either an administrator for the entire<br>
<a href="#Portal">Portal</a> or the owner of the group.<br>
<br>
Arguments<br>
user_names required string, comma-separated users<br>
group_id required string, specifying group id<br>
<br>
Returns <br>
A dictionary with a key of "not_added" which contains the users that were not <br>
added to the group.</tt></dd></dl>
<dl><dt><a name="Portal-create_group"><strong>create_group</strong></a>(self, title, tags, description<font color="#909090">=None</font>, snippet<font color="#909090">=None</font>, access<font color="#909090">='public'</font>, thumbnail<font color="#909090">=None</font>, is_invitation_only<font color="#909090">=False</font>, sort_field<font color="#909090">='avgRating'</font>, sort_order<font color="#909090">='desc'</font>, is_view_only<font color="#909090">=False</font>)</dt><dd><tt>Creates a group and returns a group id if successful. <br>
<br>
Arguments<br>
title required string, name of the group<br>
tags required string, comma-delimited list of tags<br>
description optional string, describes group in detail<br>
snippet optional string, <250 characters summarizes group<br>
access optional string, can be private, public, or org<br>
thumbnail optional string, URL to group image<br>
isInvitationOnly optional boolean, defines whether users can join by request.<br>
sort_field optional string, specifies how shared items with the group are sorted.<br>
sort_order optional string, asc or desc for ascending or descending.<br>
is_view_only optional boolean, defines whether the group is searchable<br>
<br>
Returns<br>
a string that is a group id.</tt></dd></dl>
<dl><dt><a name="Portal-create_group_from_dict"><strong>create_group_from_dict</strong></a>(self, group, thumbnail<font color="#909090">=None</font>)</dt><dd><tt>Creates a group and returns a group id if successful.<br>
<br>
Note<br>
Use create_group in most cases. This method is useful for taking a group<br>
dict returned from another PortalPy call and copying it.<br>
<br>
Arguments<br>
group dict <a href="__builtin__.html#object">object</a><br>
thumbnail url to image<br>
<br>
Example<br>
<a href="#Portal-create_group">create_group</a>({'title': 'Test', 'access':'public'})</tt></dd></dl>
<dl><dt><a name="Portal-delete_group"><strong>delete_group</strong></a>(self, group_id)</dt><dd><tt>Deletes a group. <br>
<br>
Arguments<br>
group_id is a string containing the id for the group to be deleted.<br>
<br>
Returns <br>
a boolean indicating whether it was successful.</tt></dd></dl>
<dl><dt><a name="Portal-delete_user"><strong>delete_user</strong></a>(self, username, cascade<font color="#909090">=False</font>, reassign_to<font color="#909090">=None</font>)</dt><dd><tt>Deletes a user from the portal, optionally deleting or reassigning groups and items.<br>
<br>
Notes<br>
You can not delete a user in <a href="#Portal">Portal</a> if that user owns groups or items. If you<br>
choose to cascade then those items and groups will be reassigned to<br>
the user identified in the reassign_to option. If you choose not to cascade<br>
the deletion will either succeed or fail depending on whether the user's items<br>
and groups have previously been transferred.<br>
<br>
When cascading, this method will delete up to 10,000 items. If the user<br>
has more than 10,000 items the method will fail. <br>
<br>
Arguments<br>
username required string, the name of the user<br>
cascade: optional boolean, true means reassign items and groups<br>
reassign_to optional string, new owner of items and groups<br>
<br>
Returns<br>
a boolean indicating whether the operation succeeded or failed.</tt></dd></dl>
<dl><dt><a name="Portal-generate_token"><strong>generate_token</strong></a>(self, username, password, expiration<font color="#909090">=60</font>)</dt><dd><tt>Generates and returns a new token, but doesn't re-login. <br>
<br>
Notes<br>
This method is not needed when using the <a href="#Portal">Portal</a> class<br>
to make calls into <a href="#Portal">Portal</a>. It's provided for the benefit<br>
of making calls into <a href="#Portal">Portal</a> outside of the <a href="#Portal">Portal</a> class.<br>
<br>
<a href="#Portal">Portal</a> uses a token-based authentication mechanism where<br>
a user provides their credentials and a short-term token<br>
is used for calls. Most calls made to the <a href="#Portal">Portal</a> REST API<br>
require a token and this can be appended to those requests.<br>
<br>
Arguments<br>
username required string, name of the user<br>
password required password, name of the user<br>
expiration optional integer, number of minutes until the token expires<br>
<br>
Returns<br>
a string with the token</tt></dd></dl>
<dl><dt><a name="Portal-get_group"><strong>get_group</strong></a>(self, group_id)</dt><dd><tt>Returns group information for the specified group group_id. <br>
<br>
Arguments <br>
group_id : required string, indicating group.<br>
<br>
Returns <br>
a dictionary <a href="__builtin__.html#object">object</a> with the group's information. The keys in<br>
the dictionary <a href="__builtin__.html#object">object</a> will often include:<br>
title: the name of the group<br>
isInvitationOnly: if set to true, users can't apply to join the group.<br>
owner: the owner username of the group<br>
description: explains the group<br>
snippet: a short summary of the group<br>
tags: user-defined tags that describe the group<br>
phone: contact information for group.<br>
thumbnail: File name relative to <a href="http://<community-url>/groups/<groupId>/info">http://<community-url>/groups/<groupId>/info</a> <br>
created: When group created, ms since 1 Jan 1970<br>
modified: When group last modified. ms since 1 Jan 1970<br>
access: Can be private, org, or public.<br>
userMembership: A dict with keys username and memberType. <br>
memberType: provides the calling user's access (owner, admin, member, none).</tt></dd></dl>
<dl><dt><a name="Portal-get_group_members"><strong>get_group_members</strong></a>(self, group_id)</dt><dd><tt>Returns members of the specified group.<br>
<br>
Arguments<br>
group_id: required string, specifies the group<br>
<br>
Returns <br>
a dictionary with keys: owner, admins, and users.<br>
owner string value, the group's owner<br>
admins list of strings, typically this is the same as the owner.<br>
users list of strings, the members of the group<br>
<br>
Example (to print users in a group)<br>
response = portal.<a href="#Portal-get_group_members">get_group_members</a>("67e1761068b7453693a0c68c92a62e2e")<br>
for user in response['users'] :<br>
print user</tt></dd></dl>
<dl><dt><a name="Portal-get_group_thumbnail"><strong>get_group_thumbnail</strong></a>(self, group_id)</dt><dd><tt>Returns the bytes that make up the thumbnail for the specified group group_id.<br>
<br>
Arguments<br>
group_id: required string, specifies the group's thumbnail<br>
<br>
Returns <br>
bytes that representt he image.<br>
<br>
Example <br>
response = portal.<a href="#Portal-get_group_thumbnail">get_group_thumbnail</a>("67e1761068b7453693a0c68c92a62e2e")<br>
f = open(filename, 'wb')<br>
f.write(response)</tt></dd></dl>
<dl><dt><a name="Portal-get_org_users"><strong>get_org_users</strong></a>(self, max_users<font color="#909090">=1000</font>)</dt><dd><tt>Returns all users within the portal organization. <br>
<br>
Arguments<br>
max_users : optional int, the maximum number of users to return.<br>
<br>
Returns <br>
a list of dicts. Each dict has the following keys:<br>
username : string<br>
storageUsage: int<br>
storageQuota: int<br>
description: string<br>
tags: list of strings<br>
region: string <br>
created: int, when account created, ms since 1 Jan 1970<br>
modified: int, when account last modified, ms since 1 Jan 1970<br>
email: string<br>
culture: string<br>
orgId: string<br>
preferredView: string<br>
groups: list of strings<br>
role: string (org_user, org_publisher, org_admin) <br>
fullName: string<br>
thumbnail: string<br>
idpUsername: string<br>
<br>
Example (print all usernames in portal):<br>
<br>
resp = portalAdmin.<a href="#Portal-get_org_users">get_org_users</a>()<br>
for user in resp:<br>
print user['username']</tt></dd></dl>
<dl><dt><a name="Portal-get_properties"><strong>get_properties</strong></a>(self, force<font color="#909090">=False</font>)</dt><dd><tt>Returns the portal properties (using cache unless force=True).</tt></dd></dl>
<dl><dt><a name="Portal-get_user"><strong>get_user</strong></a>(self, username)</dt><dd><tt>Returns the user information for the specified username. <br>
<br>
Arguments<br>
username required string, the username whose information you want.<br>
<br>
Returns<br>
None if the user is not found and returns a dictionary <a href="__builtin__.html#object">object</a> if the user is found<br>
the dictionary has the following keys: <br>
access string<br>
created time (int) <br>
culture string, two-letter language code ('en')<br>
description string<br>
email string<br>
fullName string <br>
idpUsername string, name of the user in the enterprise system <br>
groups list of dictionaries. For dictionary keys, see get_group doc.<br>
modified time (int)<br>
orgId string, the organization id<br>
preferredView string, value is either Web, GIS, or null<br>
region string, None or two letter country code <br>
role string, value is either org_user, org_publisher, org_admin<br>
storageUsage int<br>
storageQuota int<br>
tags list of strings <br>
thumbnail string, name of file<br>
username string, name of user</tt></dd></dl>
<dl><dt><a name="Portal-get_version"><strong>get_version</strong></a>(self, force<font color="#909090">=False</font>)</dt><dd><tt>Returns the portal version (using cache unless force=True). <br>
<br>
Note:<br>
The version information is retrieved when you create the<br>
<a href="#Portal">Portal</a> <a href="__builtin__.html#object">object</a> and then cached for future requests. If you<br>
want to make a request to the <a href="#Portal">Portal</a> and not rely on the<br>
cache then you can set the force argument to True.<br>
<br>
Arguments:<br>
force boolean, true=make a request, false=use cache<br>
<br>
Returns<br>
a string with the version. The version is an internal number<br>
that may not match the version of the product purchased. So<br>
2.3 is returned from <a href="#Portal">Portal</a> 10.2.1 for instance.</tt></dd></dl>
<dl><dt><a name="Portal-invite_group_users"><strong>invite_group_users</strong></a>(self, user_names, group_id, role<font color="#909090">='group_member'</font>, expiration<font color="#909090">=10080</font>)</dt><dd><tt>Invites users to a group.<br>
<br>
Notes:<br>
A user who is invited to a group will see a list of invitations<br>
in the "Groups" tab of portal listing invitations. The user<br>
can either accept or reject the invitation.<br>
<br>
Requires<br>
The user executing the command must be group owner<br>
<br>
Arguments<br>
user_names: a required string list of users to invite<br>
group_id : required string, specifies the group you are inviting users to.<br>
role: an optional string, either group_member or group_admin<br>
expiration: an optional int, specifies how long the invitation is valid for in minutes.<br>
<br>
Returns<br>
a boolean that indicates whether the call succeeded.</tt></dd></dl>
<dl><dt><a name="Portal-is_all_ssl"><strong>is_all_ssl</strong></a>(self)</dt><dd><tt>Returns true if this portal requires SSL.</tt></dd></dl>
<dl><dt><a name="Portal-is_arcgisonline"><strong>is_arcgisonline</strong></a>(self)</dt><dd><tt>Returns true if this portal is ArcGIS Online.</tt></dd></dl>
<dl><dt><a name="Portal-is_logged_in"><strong>is_logged_in</strong></a>(self)</dt><dd><tt>Returns true if logged into the portal.</tt></dd></dl>
<dl><dt><a name="Portal-is_multitenant"><strong>is_multitenant</strong></a>(self)</dt><dd><tt>Returns true if this portal is multitenant.</tt></dd></dl>
<dl><dt><a name="Portal-is_org"><strong>is_org</strong></a>(self)</dt><dd><tt>Returns true if this portal is an organization.</tt></dd></dl>
<dl><dt><a name="Portal-is_subscription"><strong>is_subscription</strong></a>(self)</dt><dd><tt>Returns true if this portal is an ArcGIS Online subscription.</tt></dd></dl>
<dl><dt><a name="Portal-leave_group"><strong>leave_group</strong></a>(self, group_id)</dt><dd><tt>Removes the logged in user from the specified group. <br>
<br>
Requires: <br>
User must be logged in.<br>
<br>
Arguments:<br>
group_id: required string, specifies the group id<br>
<br>
Returns:<br>
a boolean indicating whether the operation was successful.</tt></dd></dl>
<dl><dt><a name="Portal-logged_in_user"><strong>logged_in_user</strong></a>(self)</dt><dd><tt>Returns information about the logged in user.<br>
<br>
Returns <br>
a dict with the following keys:<br>
username string<br>
storageUsage int<br>
description string<br>
tags comma-separated string<br>
created int, when group created (ms since 1 Jan 1970) <br>
modified int, when group last modified (ms since 1 Jan 1970)<br>
fullName string<br>
email string<br>
idpUsername string, name of the user in their identity provider</tt></dd></dl>
<dl><dt><a name="Portal-login"><strong>login</strong></a>(self, username, password, expiration<font color="#909090">=60</font>)</dt><dd><tt>Logs into the portal using username/password. <br>
<br>
Notes:<br>
You can log into a portal when you construct a portal<br>
<a href="__builtin__.html#object">object</a> or you can login later. This function is <br>
for the situation when you need to log in later.<br>
<br>
Arguments<br>
username: required string<br>
password: required string<br>
expiration: optional int, how long the token generated should last.<br>
<br>
Returns<br>
a string, the token</tt></dd></dl>
<dl><dt><a name="Portal-logout"><strong>logout</strong></a>(self)</dt><dd><tt>Logs out of the portal. <br>
<br>
Notes<br>
The portal will forget any existing tokens it was using, all <br>
subsequent portal calls will be anonymous until another login<br>
call occurs.<br>
<br>
Returns<br>
No return value.</tt></dd></dl>
<dl><dt><a name="Portal-reassign_group"><strong>reassign_group</strong></a>(self, group_id, target_owner)</dt><dd><tt>Reassigns a group to another owner. <br>
<br>
Arguments<br>
group_id : required string, unique identifier for the group<br>
target_owner: required string, username of new group owner<br>
<br>
Returns<br>
a boolean, indicating success</tt></dd></dl>
<dl><dt><a name="Portal-remove_group_users"><strong>remove_group_users</strong></a>(self, user_names, group_id)</dt><dd><tt>Remove users from a group.<br>
<br>
Arguments:<br>
user_names required string, comma-separated list of users <br>
group_id required string, the id for a group.<br>
<br>
Returns:<br>
a dictionary with a key notRemoved that is a list of users not removed.</tt></dd></dl>
<dl><dt><a name="Portal-reset_user"><strong>reset_user</strong></a>(self, username, password, new_password<font color="#909090">=None</font>, new_security_question<font color="#909090">=None</font>, new_security_answer<font color="#909090">=None</font>)</dt><dd><tt>Resets a user's password, security question, and/or security answer.<br>
<br>
Notes<br>
This function does not apply to those using enterprise accounts<br>
that come from an enterprise such as ActiveDirectory, LDAP, or SAML.<br>
It only has an effect on built-in users.<br>
<br>
If a new security question is specified, a new security answer should<br>
be provided.<br>
<br>
<br>
Arguments<br>
username required string, account being reset<br>
password required string, current password<br>
new_password optional string, new password if resetting password<br>
new_security_question optional int, new security question if desired<br>
new_security_answer optional string, new security question answer if desired<br>
<br>
Returns<br>
a boolean, indicating success</tt></dd></dl>
<dl><dt><a name="Portal-search"><strong>search</strong></a>(self, q, bbox<font color="#909090">=None</font>, sort_field<font color="#909090">='title'</font>, sort_order<font color="#909090">='asc'</font>, max_results<font color="#909090">=1000</font>, add_org<font color="#909090">=True</font>)</dt></dl>
<dl><dt><a name="Portal-search_groups"><strong>search_groups</strong></a>(self, q, sort_field<font color="#909090">='title'</font>, sort_order<font color="#909090">='asc'</font>, max_groups<font color="#909090">=1000</font>, add_org<font color="#909090">=True</font>)</dt><dd><tt>Searches for portal groups.<br>
<br>
Notes<br>
A few things that will be helpful to know.<br>
<br>
1. The query syntax has quite a few features that can't <br>
be adequately described here. The query syntax is <br>
available in ArcGIS help. A short version of that URL<br>
is <a href="http://bitly.com/1fJ8q31">http://bitly.com/1fJ8q31</a>.<br>
<br>
2. Most of the time when searching groups you want to <br>
search within your organization in ArcGIS Online<br>
or within your <a href="#Portal">Portal</a>. As a convenience, the method<br>
automatically appends your organization id to the query by <br>
default. If you don't want the API to append to your query<br>
set add_org to false. <br>
<br>
Arguments<br>
q required string, query string. See notes.<br>
sort_field optional string, valid values can be title, owner, created<br>
sort_order optional string, valid values are asc or desc<br>
max_groups optional int, maximum number of groups returned <br>
add_org optional boolean, controls whether to search within your org<br>
<br>
Returns<br>
A list of dictionaries. Each dictionary has the following keys.<br>
access string, values=private, org, public<br>
created int, ms since 1 Jan 1970<br>
description string<br>
id string, unique id for group<br>
isInvitationOnly boolean<br>
isViewOnly boolean<br>
modified int, ms since 1 Jan 1970<br>
owner string, user name of owner<br>
phone string<br>
snippet string, short summary of group<br>
sortField string, how shared items are sorted<br>
sortOrder string, asc or desc<br>
tags string list, user supplied tags for searching<br>
thumbnail string, name of file. Append to <a href="http://<community">http://<community</a> url>/groups/<group id>/info/<br>
title string, name of group as shown to users</tt></dd></dl>
<dl><dt><a name="Portal-search_users"><strong>search_users</strong></a>(self, q, sort_field<font color="#909090">='username'</font>, sort_order<font color="#909090">='asc'</font>, max_users<font color="#909090">=1000</font>, add_org<font color="#909090">=True</font>)</dt><dd><tt>Searches portal users. <br>
<br>
Notes<br>
A few things that will be helpful to know.<br>
<br>
1. The query syntax has quite a few features that can't <br>
be adequately described here. The query syntax is <br>
available in ArcGIS help. A short version of that URL<br>
is <a href="http://bitly.com/1fJ8q31">http://bitly.com/1fJ8q31</a>.<br>
<br>
2. Most of the time when searching groups you want to <br>
search within your organization in ArcGIS Online<br>
or within your <a href="#Portal">Portal</a>. As a convenience, the method<br>
automatically appends your organization id to the query by <br>
default. If you don't want the API to append to your query<br>
set add_org to false. <br>
<br>
Arguments<br>
q required string, query string. See notes.<br>
sort_field optional string, valid values can be username or created<br>
sort_order optional string, valid values are asc or desc<br>
max_users optional int, maximum number of users returned <br>
add_org optional boolean, controls whether to search within your org<br>
<br>
Returns<br>
A dictionary <a href="__builtin__.html#object">object</a> with the following keys:<br>
created time (int), when user created<br>
culture string, two-letter language code<br>
description string, user supplied description <br>
fullName string, name of the user<br>
modified time (int), when user last modified<br>
region string, may be None<br>
tags string list, of user tags<br>
thumbnail string, name of file<br>
username string, name of the user</tt></dd></dl>
<dl><dt><a name="Portal-signup"><strong>signup</strong></a>(self, username, password, fullname, email)</dt><dd><tt>Signs up users to an instance of <a href="#Portal">Portal</a> for ArcGIS. <br>
<br>
Notes:<br>
This method only applies to <a href="#Portal">Portal</a> and not ArcGIS<br>
Online. This method can be called anonymously, but<br>
keep in mind that self-signup can also be disabled <br>
in a <a href="#Portal">Portal</a>. It also only creates built-in<br>
accounts, it does not work with enterprise<br>
accounts coming from ActiveDirectory or your<br>
LDAP. <br>
<br>
There is another method called createUser that <br>
requires administrator access that can always<br>
be used against 10.2.1 portals or later that<br>
can create users whether they are builtin or<br>
enterprise accounts.<br>
<br>
Arguments<br>
username required string, must be unique in the <a href="#Portal">Portal</a>, >4 characters<br>
password required string, must be >= 8 characters.<br>
fullname required string, name of the user<br>
email required string, must be an email address<br>
<br>
Returns<br>
a boolean indicating success</tt></dd></dl>
<dl><dt><a name="Portal-update_group"><strong>update_group</strong></a>(self, group_id, title<font color="#909090">=None</font>, tags<font color="#909090">=None</font>, description<font color="#909090">=None</font>, snippet<font color="#909090">=None</font>, access<font color="#909090">=None</font>, is_invitation_only<font color="#909090">=None</font>, sort_field<font color="#909090">=None</font>, sort_order<font color="#909090">=None</font>, is_view_only<font color="#909090">=None</font>, thumbnail<font color="#909090">=None</font>)</dt><dd><tt>Updates a group.<br>
<br>
Note<br>
Only provide the values for the arguments you wish to update.<br>
<br>
Arguments<br>
group_id required string, the group to modify<br>
title optional string, name of the group<br>
tags optional string, comma-delimited list of tags<br>
description optional string, describes group in detail<br>
snippet optional string, <250 characters summarizes group<br>
access optional string, can be private, public, or org<br>
thumbnail optional string, URL or file location to group image<br>
is_invitation_only optional boolean, defines whether users can join by request.<br>
sort_field optional string, specifies how shared items with the group are sorted.<br>
sort_order optional string, asc or desc for ascending or descending.<br>
is_view_only optional boolean, defines whether the group is searchable<br>
<br>
Returns<br>
a boolean indicating success</tt></dd></dl>
<dl><dt><a name="Portal-update_user"><strong>update_user</strong></a>(self, username, access<font color="#909090">=None</font>, preferred_view<font color="#909090">=None</font>, description<font color="#909090">=None</font>, tags<font color="#909090">=None</font>, thumbnail<font color="#909090">=None</font>, fullname<font color="#909090">=None</font>, email<font color="#909090">=None</font>, culture<font color="#909090">=None</font>, region<font color="#909090">=None</font>)</dt><dd><tt>Updates a user's properties.<br>
<br>
Note:<br>
Only pass in arguments for properties you want to update.<br>
All other properties will be left as they are. If you <br>
want to update description, then only provide<br>
the description argument.<br>
<br>
Arguments:<br>
username required string, name of the user to be updated.<br>
access optional string, values: private, org, public<br>
preferred_view optional string, values: Web, GIS, null<br>
description optional string, a description of the user.<br>
tags optional string, comma-separated tags for searching<br>
thumbnail optional string, path or url to a file. can be PNG, GIF, <br>
JPEG, max size 1 MB<br>
fullname optional string, name of the user, only for built-in users <br>
email optional string, email address, only for built-in users<br>
culture optional string, two-letter language code, fr for example <br>
region optional string, two-letter country code, FR for example<br>
<br>
Returns<br>
a boolean indicating success</tt></dd></dl>
<dl><dt><a name="Portal-update_user_role"><strong>update_user_role</strong></a>(self, username, role)</dt><dd><tt>Updates a user's role.<br>
<br>
Notes<br>
There are three types of roles in <a href="#Portal">Portal</a> - user, publisher, and administrator.<br>
A user can share items, create maps, create groups, etc. A publisher can <br>
do everything a user can do and create hosted services. An administrator can <br>
do everything that is possible in <a href="#Portal">Portal</a>.<br>
<br>
Arguments<br>
username required string, the name of the user whose role will change<br>
role required string, one of these values org_user, org_publisher, org_admin<br>
<br>
Returns<br>
a boolean, that indicates success</tt></dd></dl>
</td></tr></table></td></tr></table><p>
</body></html>