~rashi007/mailman/docsfix

« back to all changes in this revision

Viewing changes to src/mailman/rest/docs/addresses.rst

  • Committer: Barry Warsaw
  • Date: 2015-02-06 03:53:56 UTC
  • Revision ID: barry@list.org-20150206035356-ufia0ei1rm6qfzkj
 * You can now DELETE an address.  If the address is linked to a user, the
   user is not delete, it is just unlinked.

Show diffs side-by-side

added added

removed removed

Lines of Context:
446
446
    http_etag: "..."
447
447
    start: 0
448
448
    total_size: 1
 
449
 
 
450
 
 
451
 
 
452
 
 
453
Deleting
 
454
========
 
455
 
 
456
Addresses can be deleted via the REST API.
 
457
::
 
458
 
 
459
    >>> fred = user_manager.create_address('fred@example.com', 'Fred Person')
 
460
    >>> transaction.commit()
 
461
    >>> dump_json('http://localhost:9001/3.0/addresses/fred@example.com')
 
462
    display_name: Fred Person
 
463
    email: fred@example.com
 
464
    http_etag: "..."
 
465
    original_email: fred@example.com
 
466
    registered_on: 2005-08-01T07:49:23
 
467
    self_link: http://localhost:9001/3.0/addresses/fred@example.com
 
468
 
 
469
    >>> dump_json('http://localhost:9001/3.0/addresses/fred@example.com',
 
470
    ...     method='DELETE')
 
471
    content-length: 0
 
472
    date: ...
 
473
    server: ...
 
474
    status: 204
 
475
    >>> transaction.abort()
 
476
 
 
477
    >>> print(user_manager.get_address('fred@example.com'))
 
478
    None
 
479
 
 
480
If an address is linked to a user, deleting the address does not delete the
 
481
user, it just unlinks it.
 
482
::
 
483
 
 
484
    >>> gwen = user_manager.create_user('gwen@example.com', 'Gwen Person')
 
485
    >>> transaction.commit()
 
486
    >>> dump_json('http://localhost:9001/3.0/users/5/addresses')
 
487
    entry 0:
 
488
        display_name: Gwen Person
 
489
        email: gwen@example.com
 
490
        http_etag: "..."
 
491
        original_email: gwen@example.com
 
492
        registered_on: 2005-08-01T07:49:23
 
493
        self_link: http://localhost:9001/3.0/addresses/gwen@example.com
 
494
        user: http://localhost:9001/3.0/users/5
 
495
    http_etag: "795b0680c57ec2df3dceb68ccce2619fecdc7225"
 
496
    start: 0
 
497
    total_size: 1
 
498
 
 
499
    >>> dump_json('http://localhost:9001/3.0/addresses/gwen@example.com',
 
500
    ...     method='DELETE')
 
501
    content-length: 0
 
502
    date: ...
 
503
    server: ...
 
504
    status: 204
 
505
 
 
506
    >>> dump_json('http://localhost:9001/3.0/users/5/addresses')
 
507
    http_etag: "..."
 
508
    start: 0
 
509
    total_size: 0