Skip to content

Web Service API

herestomwiththeweather edited this page Jan 16, 2011 · 22 revisions

Web Service API

Person

Returns information about the person including name, description, groups, accounts, created_at, identity_url, icon. You can specify your own information with person_id 0. Each account in the array will return a group_id.

(as of 1/15/2011 but this behavior will no longer be the case when groupy is merged into master branch) In the master branch, all but one account group_id can be matched with an id of a group in the groups array. One account group_id will be null and this represents the default system account for the person.

URL: http://demo.opensourcecurrency.org/people/person_id

Formats: xml, json

Method: GET

Account

Returns information about a person’s accounts

URL: http://demo.opensoucecurrency.org/people/person_id/accounts

Formats: xml, json

Method: GET

Parent Resource:

  • person_id. Required. The numerical id of the person you are trying to retrieve.

Category

Returns information about the category including the name and the people (and their icons and whether they have elected to receive notifications for requests and whether they are deactivated) who associate themselves with the skill category.

URL: http://demo.opensourcecurrency.org/categories/category_id

Formats: xml, json

Method: GET

Exchange

Return the person’s earned credits sorted by most recent. Fields in each record include amount, customer_id, created_at, req_id. A new exchange (payment) can be created with a POST and the amount must be specified in the body. Optionally, to describe the nature of the exchange, a request object may be posted with the exchange object. See examples.

URL: http://demo.opensoucecurrency.org/people/person_id/exchanges

Formats: xml, json

Method: GET, POST

Parent Resource:

  • person_id. Required. The numerical id of the person you are trying to retrieve (or the person you are paying if this is a POST)

GET Examples:

  • Get a person’s earned exchanges: http://demo.opensoucecurrency.org/people/person_id/exchanges
  • Get an exchange: http://demo.opensoucecurrency.org/people/person_id/exchanges/exchange_id

POST Parameters:

  • amount. Required. Decimal amount of payment. Up to two places after the decimal accepted

JSON Examples:

  • Make a payment:
    {"exchange":{"amount":"33"},"req":{"name":"guitar lessons"}}
  • Make a payment. no details:
    {"exchange":{"amount":"33"}}
  • Make a payment with group 5’s currency:
    {"exchange":{"amount":"33","group_id":"5"}}

Req

Returns information about the request including name, description, due_date, estimated_hours, person_id, active (boolean), created_at

URL: http://demo.opensoucecurrency.org/reqs/req_id

Formats: xml, json

Method: GET, POST

POST Parameters:

  • name
  • description
  • due_date
  • estimated_hours

New Protocol Ideas

Transaction

Accepts a list of transactions, an OAuth secret for the service, and an OAuth authentication token for the user. It attempts to perform the transactions and returns the results.

URL: http://demo.opensoucecurrency.org/transaction

Formats: json

Method: POST

POST Parameters:

  • service_secret – The OAuth secret obtained when the service was registered.
  • user_token – An OAuth token to be used in authenticating the user
  • transactions – A list of transactions

Transaction types:

Withdraw [amount] – Transfer [amount] from user account to service account
Returns success status, new balance
Deposit [amount] – Transfer [amount] from service account to user account
Returns success status, new balance
CheckBalance – Obtain the user’s current balance
Returns success status, current balance

Clone this wiki locally