User Tools

Site Tools


developers:api:user

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.

    $ curl -u user:pass -d "name=George&email=george@example.com" \
    >      https://api.snapbill.com/v1/client/158958/add_user.json

File: examples/user.txt-1.json -

    {
      "code": 200,
      "type": "item",
      "class": "user",
      "user": {
        "depth": 0,
        "id": 2481,
        "xid": "Clw:mx",
        "username": "george1",
        "password": "f*cjPyT!3xe",
        "name": "George",
        "email": "george@example.com",
        "type": "user",
        "client": {
          "depth": 1,
          "id": 158958,
          "xid": "Clw:mzu",
          "state": "active",
          "number": "001",
          "name": "test4128",
          "account": {
            "depth": 1,
            "id": 10608,
            "xid": "Clw:Clw",
            "username": "demo"
          },
          "cell": "",
          "company": "",
          "country": {
            "code": "ZA",
            "iso2": "ZA",
            "iso3": "ZAF",
            "name": "South Africa"
          },
          "credit": "0.00",
          "credit_cents": 0,
          "currency": {
            "code": "ZAR",
            "format": "R%.2f",
            "enabled": true
          },
          "discount": "0.00",
          "email": "",
          "firstname": "test4128",
          "payment": "netcash",
          "payment_method": {
            "depth": 2,
            "code": "netcash",
            "name": "Netcash Collect",
            "enabled": true
          },
          "surname": "",
          "totals": {
            "unpaid_invoices": "555.58",
            "unpaid_invoices_cents": 55558,
            "paid_payments": "0.00",
            "paid_payments_cents": 0
          },
          "urls": {
            "statement": "https://demo.snapbill.com/statement/Clw:mzu/=NTYxY2UyN2E5",
            "payment": "https://demo.snapbill.com/payment/client/Clw:mzu/=YjE5YTM0YWNm"
          },
          "data": {
            "public_city": null,
            "public_country": null,
            "public_fax": null,
            "public_phone": null,
            "public_postal": null,
            "public_postcode": null,
            "public_province": null,
            "public_street": null,
            "vat_number": null
          }
        }
      }
    }

/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.
    $ curl -u user:pass -d "username=george" \
    >      https://api.snapbill.com/v1/user/list.json

File: examples/user.txt-2.json -

    {
      "code": 200,
      "type": "list",
      "page": 1,
      "numpages": 1,
      "class": "user",
      "list": [
        {
          "depth": 0,
          "id": 2480,
          "xid": "Clw:mw",
          "username": "george",
          "name": "George",
          "email": "george@example.com",
          "type": "user",
          "client": {
            "depth": 1,
            "id": 158958,
            "xid": "Clw:mzu",
            "state": "active",
            "number": "001",
            "name": "test4128",
            "account": {
              "depth": 1,
              "id": 10608,
              "xid": "Clw:Clw",
              "username": "demo"
            },
            "cell": "",
            "company": "",
            "country": {
              "code": "ZA",
              "iso2": "ZA",
              "iso3": "ZAF",
              "name": "South Africa"
            },
            "credit": "0.00",
            "credit_cents": 0,
            "currency": {
              "code": "ZAR",
              "format": "R%.2f",
              "enabled": true
            },
            "discount": "0.00",
            "email": "",
            "firstname": "test4128",
            "payment": "netcash",
            "payment_method": {
              "depth": 2,
              "code": "netcash",
              "name": "Netcash Collect",
              "enabled": true
            },
            "surname": "",
            "totals": {
              "unpaid_invoices": "555.58",
              "unpaid_invoices_cents": 55558,
              "paid_payments": "0.00",
              "paid_payments_cents": 0
            },
            "urls": {
              "statement": "https://demo.snapbill.com/statement/Clw:mzu/=NTYxY2UyN2E5",
              "payment": "https://demo.snapbill.com/payment/client/Clw:mzu/=YjE5YTM0YWNm"
            },
            "data": {
              "public_city": null,
              "public_country": null,
              "public_fax": null,
              "public_phone": null,
              "public_postal": null,
              "public_postcode": null,
              "public_province": null,
              "public_street": null,
              "vat_number": null
            }
          }
        }
      ]
    }

/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.

    $ curl -u user:pass -d "" \
    >      https://api.snapbill.com/v1/user/2480/add_session.json

File: examples/user.txt-3.json -

    {
      "code": 200,
      "type": "item",
      "class": "session",
      "session": {
        "depth": 0,
        "url": "https://demo.snapbill.com/session/s1.cee127d7c7b9df84b70200e3a899ca16bdf22828/=ZGZhNjZjNWM0"
      }
    }

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.
developers/api/user.txt · Last modified: 2014/10/18 12:29 by Jaco van Wyk