This shows you the differences between two versions of the page.
developers:api:user [2014/10/16 13:11] Jaco van Wyk created |
developers:api:user [2014/10/18 12:29] Jaco van Wyk |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Users ====== | ====== Users ====== | ||
+ | User objects allow clients to login to the client area [[https://<your username>.snapbill.com]]. | ||
+ | |||
+ | ===== /v1/client/id/add_user ===== | ||
+ | |||
+ | This api call will create a user. Since we have not specified the username and password they will be automatically generated. | ||
+ | |||
+ | Note The password is returned here, but will not be available in future requests. | ||
+ | |||
+ | <code php> | ||
+ | $ curl -u user:pass -d "name=George&email=george@example.com" \ | ||
+ | > https://api.snapbill.com/v1/client/158958/add_user.json | ||
+ | </code> | ||
+ | |||
+ | <source examples/user.txt-1.json> | ||
+ | |||
+ | ===== /v1/user/list ===== | ||
+ | |||
+ | ^Name ^Required ^Description^ | ||
+ | |username |optional |Only list users with the given username| | ||
+ | |password |optional |List users with the given password. Note that this is only available if username is provided, and functions as a username/password check)| | ||
+ | |client_id |optional |List users with belonging to the given client| | ||
+ | |perpage |optional |Show this number of users per page. Default value is 25, maximum is 100.| | ||
+ | |page |optional |Show users on this page. The default value is 1.| | ||
+ | |||
+ | <code php> | ||
+ | $ curl -u user:pass -d "username=george" \ | ||
+ | > https://api.snapbill.com/v1/user/list.json | ||
+ | </code> | ||
+ | |||
+ | <source examples/user.txt-2.json> | ||
+ | |||
+ | ===== /v1/user/id/add_session ===== | ||
+ | |||
+ | This api call will create a session in the client area for a given user. This allows you to provide automatic login functionality on your website. | ||
+ | |||
+ | Note The session created will time out if the user is not redirected to the url provided. | ||
+ | |||
+ | <code php> | ||
+ | $ curl -u user:pass -d "" \ | ||
+ | > https://api.snapbill.com/v1/user/2480/add_session.json | ||
+ | </code> | ||
+ | |||
+ | <source examples/user.txt-3.json> | ||
+ | |||
+ | ==== Parameter listing ==== | ||
+ | |||
+ | ^Name ^Availability ^^Description^ | ||
+ | |depth | |get |The depth parameter signals the amount of data for the user that was provided. depth=0 is the highest level that provides full detail.| | ||
+ | |id | |get |The id of the user in the system. This is guaranteed to be unique only over a single account.| | ||
+ | |xid | |get |The xid of the user in the system. This is guaranteed to be unique over all accounts (see Concepts - Xid)| | ||
+ | |name |add |get |The users name which is displayed while logged in| | ||
+ | |email |add |get |Contact email address. Lost password recovery will accept this address to reset just the single users password.| | ||
+ | |username |add |get |Username for login in the client area| | ||
+ | |password |add | |Password for the client area. Once added this is hashed using bcrypt and not recoverable, although you can easily check if you have the correct password with a search.| |