Getting Started
Install halchemy using the package manager of your chosen language:
bash
pip install halchemybash
npm install halchemybash
gem install halchemyIn your code, create an Api object with the URL of your API.
python
from halchemy import Api
api = Api('http://example.org/api')
home = api.home.get() # get the home resource
people = api.follow(home).to('people').get() # follow the people rel to get the list of people
# Issue a refund of $5 to everyone
for person in people['_items']:
account = api.follow(person).to('account').get()
api.follow(account).to('deposit').post({'amount':5.00})javascript
import { Api } from 'halchemy'
const api = new Api('http://example.org/api')
const home = api.home.get() // get the home resource
const people = api.follow(home).to('people').get() // follow the people rel to get the list of people
// Issue a refund of $5 to everyone
for (const person of people._items) {
const account = async api.follow(person).to('account').get()
async api.follow(account).to('deposit').post({amount:5.00})
}ruby
require "halchemy"
api = Halchemy::Api.new "http://example.org/api"
home = api.home.get # get the home resource
people = api.follow(home).to("people").get # follow the people rel to get the list of people
# Issue a refund of $5 to everyone
people["_items"].each do |person|
account = api.follow(person).to("account").get
api.follow(account).to("deposit").post("amount"=> 5.00)
end