Skip to content

Web Service API

herestomwiththeweather edited this page Sep 13, 2010 · 22 revisions

Web Service API

Person

Returns information about the person including name, description, created_at, identity_url

URL: http://demo.opensourcecurrency.org/people/%{color:red}person_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/%{color:red}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/%{color:red}person_id%/exchanges
  • Get an exchange: http://demo.opensoucecurrency.org/people/%{color:red}person_id%/exchanges/%{color:red}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"}}'

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/%{color:red}req_id%

Formats: xml, json

Method: GET, POST

POST Parameters:

  • name
  • description
  • due_date
  • estimated_hours

Clone this wiki locally