This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
developers:api:client [2014/10/17 20:23] Jaco van Wyk |
developers:api:client [2014/10/18 07:13] Jaco van Wyk |
||
---|---|---|---|
Line 5: | Line 5: | ||
Retrieve a client by id and return it's details. | Retrieve a client by id and return it's details. | ||
- | <code> | + | <code php> |
$ curl -u user:pass -d "" \ | $ curl -u user:pass -d "" \ | ||
> https://api.snapbill.com/v1/client/158975/get.json | > https://api.snapbill.com/v1/client/158975/get.json | ||
Line 16: | Line 16: | ||
Creates a new client and returns it's details. | Creates a new client and returns it's details. | ||
- | <code> | + | <code php> |
$ curl -u user:pass -d "firstname=jane&email=jane@example.com" \ | $ curl -u user:pass -d "firstname=jane&email=jane@example.com" \ | ||
> https://api.snapbill.com/v1/client/add.json | > https://api.snapbill.com/v1/client/add.json | ||
</code> | </code> | ||
- | <code> | + | <source examples/client.txt-2.json> |
- | { | + | |
- | + | ||
- | code: 200, | + | |
- | type: "item", | + | |
- | class: "client", | + | |
- | client: { | + | |
- | depth: 0, | + | |
- | id: 158975, | + | |
- | xid: "Clw:mz_", | + | |
- | state: "active", | + | |
- | number: "018", | + | |
- | name: "jane", | + | |
- | 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: "jane@example.com", | + | |
- | firstname: "jane", | + | |
- | payment: "netcash", | + | |
- | payment_method: { | + | |
- | depth: 1, | + | |
- | code: "netcash", | + | |
- | name: "Netcash Collect", | + | |
- | enabled: true | + | |
- | }, | + | |
- | surname: "", | + | |
- | totals: { | + | |
- | unpaid_invoices: "0.00", | + | |
- | unpaid_invoices_cents: 0, | + | |
- | paid_payments: "0.00", | + | |
- | paid_payments_cents: 0 | + | |
- | }, | + | |
- | urls: { | + | |
- | statement: "https:\/\/demo.snapbill.com\/statement\/Clw:mz_\/=YzhjNzU1Y2Mx", | + | |
- | payment: "https:\/\/demo.snapbill.com\/payment\/client\/Clw:mz_\/=NTdkMTBmMTIz" | + | |
- | }, | + | |
- | 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 | + | |
- | }, | + | |
- | services: [ ] | + | |
- | } | + | |
- | + | ||
- | } | + | |
- | </code> | + | |
===== /v1/client/id/update ===== | ===== /v1/client/id/update ===== | ||
Line 97: | Line 27: | ||
Updates details about the given client in the database | Updates details about the given client in the database | ||
- | <code> | + | <code php> |
$ curl -u user:pass -d "company=helkom&state=suspended" \ | $ curl -u user:pass -d "company=helkom&state=suspended" \ | ||
> https://api.snapbill.com/v1/client/158975/update.json | > https://api.snapbill.com/v1/client/158975/update.json | ||
</code> | </code> | ||
- | <code> | + | <source examples/client.txt-3.json> |
- | { | + | |
- | + | ||
- | code: 200, | + | |
- | type: "result", | + | |
- | status: "ok", | + | |
- | class: "client", | + | |
- | client: { | + | |
- | depth: 0, | + | |
- | id: 158975, | + | |
- | xid: "Clw:mz_", | + | |
- | state: "active", | + | |
- | number: "018", | + | |
- | name: "helkom (jane)", | + | |
- | account: { | + | |
- | depth: 1, | + | |
- | id: 10608, | + | |
- | xid: "Clw:Clw", | + | |
- | username: "demo" | + | |
- | }, | + | |
- | cell: "", | + | |
- | company: "helkom", | + | |
- | 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: "jane@example.com", | + | |
- | firstname: "jane", | + | |
- | payment: "netcash", | + | |
- | payment_method: { | + | |
- | depth: 1, | + | |
- | code: "netcash", | + | |
- | name: "Netcash Collect", | + | |
- | enabled: true | + | |
- | }, | + | |
- | surname: "", | + | |
- | totals: { | + | |
- | unpaid_invoices: "0.00", | + | |
- | unpaid_invoices_cents: 0, | + | |
- | paid_payments: "0.00", | + | |
- | paid_payments_cents: 0 | + | |
- | }, | + | |
- | urls: { | + | |
- | statement: "https:\/\/demo.snapbill.com\/statement\/Clw:mz_\/=YzhjNzU1Y2Mx", | + | |
- | payment: "https:\/\/demo.snapbill.com\/payment\/client\/Clw:mz_\/=NTdkMTBmMTIz" | + | |
- | }, | + | |
- | 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 | + | |
- | }, | + | |
- | services: [ ] | + | |
- | } | + | |
- | + | ||
- | } | + | |
- | </code> | + | |
==== Available states ==== | ==== Available states ==== | ||
Line 246: | Line 105: | ||
The example below updates the payment type to other which requires no extra parameters. | The example below updates the payment type to other which requires no extra parameters. | ||
- | <code> | + | <code php> |
$ curl -u user:pass -d "payment_method_code=other" \ | $ curl -u user:pass -d "payment_method_code=other" \ | ||
> https://api.snapbill.com/v1/client/158975/set_payment.json | > https://api.snapbill.com/v1/client/158975/set_payment.json | ||
</code> | </code> | ||
- | <code> | + | <source examples/client.txt-4.json> |
- | { | + | |
- | + | ||
- | code: 200, | + | |
- | type: "result", | + | |
- | status: "ok" | + | |
- | + | ||
- | } | + | |
- | </code> | + | |
===== /v1/client/id/delete ===== | ===== /v1/client/id/delete ===== | ||
Line 265: | Line 116: | ||
Deletes a client from the database | Deletes a client from the database | ||
- | <code> | + | <code php> |
$ curl -u user:pass -d "" \ | $ curl -u user:pass -d "" \ | ||
> https://api.snapbill.com/v1/client/158975/delete.json | > https://api.snapbill.com/v1/client/158975/delete.json | ||
</code> | </code> | ||
- | <code> | + | <source examples/client.txt-5.json> |
- | { | + | |
- | + | ||
- | code: 200, | + | |
- | type: "result", | + | |
- | status: "ok" | + | |
- | + | ||
- | } | + | |
- | </code> | + | |
===== /v1/client/list ===== | ===== /v1/client/list ===== |