Skip to content

Instantly share code, notes, and snippets.

@h5y1m141
Created August 21, 2012 22:15
Show Gist options
  • Save h5y1m141/3419912 to your computer and use it in GitHub Desktop.
Save h5y1m141/3419912 to your computer and use it in GitHub Desktop.
Appcelerator Cloud Services: create place via REST API
require 'rest_client'
require 'json'
ACS_REST_ENTRY = 'https://api.cloud.appcelerator.com/v1/places/'
API_KEY = 'xxxxxxxx'
LOGIN_URL = 'https://api.cloud.appcelerator.com/v1/users/login.json?key='
res = RestClient.post(LOGIN_URL + API_KEY ,
:login => 'myuser@gmail.com',
:password => 'password')
session = res.cookies
p res.code # => login success, return status code 200
RestClient.post(ACS_REST_ENTRY + 'create.json?key=' + API_KEY ,
:latitude => 35.752224,
:latitude => 139.638475,
:name => 'UNION BAKERY',
:address => '練馬区春日町6-5-4' ,
:city => "東京都",
:country => "日本",
:phone_number => '03-3999-0759',
:custom_fields => {:beers => {:beer_name => '銀河高原ビール'}},:cookies => {:_session_id => session})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment