Migration from Billing API ========================== Plan List ^^^^^^^^^ A list of plans can be fetched from Accounts API by issuing a `GET` request to `/plans`. Unlike the Billing API, the Accounts API returns all available plans, including those with promo codes. As such, the `promo` query parameter is not supported in Accounts API. Requesting information for a specific plan is no longer supported in Accounts API; the plan list contains all plan information directly. See :ref:`list-plans` for details. User List ^^^^^^^^^ A list of users can be fetched from Accounts API by issuing a `GET` request to `/users/`. Results can now be limited by plan or group id by appending the `plan_id` or `group_id` query parameters, respectively. Additionally, you may search for users with a given name or email address with the `search` query parameter. For example, issuing the request: .. sourcecode:: http GET /users/?search=Bob%20Terwilliger HTTP/1.1 Host: example.com will return a list of users named Bob Terwilliger. See :ref:`listing-accounts` for details. User Details ^^^^^^^^^^^^ To fetch details for a specific user, issue a `GET` request to `/users/(username|email)` with the desired username or email address. Retrieving users by avatar id or share id are no longer supported in Accounts API. See :ref:`viewing-account-info` for details. To retrieve a list of devices for a given account, append `/devices` to the user's URL. See :ref:`viewing-account-devices` for details. For example, the request: .. sourcecode:: http GET /users/sideshowbob/devices HTTP/1.1 Host: example.com will return the device list for the user with username *sideshowbob*. The `service_access_restrictions` query parameter is no longer supported in Accounts API. If you need to view or change service access restrictions, please `contact support `_. Set Plan, Email, Bonus Gigs, Disable/Enable User ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Setting a user's plan or email, assigning bonus gigs, or enabling/disabling users is now accomplished by issuing a `POST` request to the user's detail URL with the appropriate parameters in the POST body. You can now also change the user's full name or group id with Accounts API. Setting to a plan requiring a promo code no longer requires you to include the promo code in the request with Accounts API. For example, to set the plan for user *sideshowbob* to plan ID 1, you would issue the request: .. sourcecode:: http POST /users/sideshowbob HTTP/1.1 Host: example.com Content-type: text/javascript { "plan_id": 1 } You may also set any number of the above parameters in a single request. For example: .. sourcecode:: http POST /users/sideshowbob HTTP/1.1 Host: example.com Content-type: text/javascript { "plan_id": 1, "group_id": 3, } would set the plan *and* group at the same time. See :ref:`modifying-accounts` for details. Purging Users ^^^^^^^^^^^^^ To purge a user, simply issue a `DELETE` request to the user's detail URL. If your HTTP request library doesn't support the `DELETE` method, you may alternatively issue a `POST` request with the query string `?action=delete` appended. .. sourcecode:: http DELETE /users/sideshowbob HTTP/1.1 Host: example.com .. sourcecode:: http POST /users/sideshowbob?action=delete HTTP/1.1 Host: example.com See :ref:`deleting-accounts` for details. Set/Clear Access Restrictions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Access restrictions are no longer supported in Accounts API. If you require the use of this feature, please `contact support `_. Ping ^^^^ The :ref:`ping method ` in the Accounts API works similarly to the ping method in the Billing API. Rather than issuing a `POST` request, however, simply issue a `GET` request to `/ping`. .. sourcecode:: http GET /ping HTTP/1.1 Host: example.com See :ref:`pinging-the-api` for details.