Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated link

...

All API calls must contain a valid App Key or 2-Legged OAuth signature and request header for the ArrowDB server to process and respond to them. See the authentication page for more information.

User sessions and cookies

...

Table Cell (td)
Code Block
linenumberstrue
languagejs
collapsetrue
$ curl --verbose -b cookies.txt -c cookies.txt -F "login=mike@appcelerator.com" -F "password=food" 
https://api.cloud.appcelerator.com/v1/users/login.json?key=vjCQ6KRqplmkektlpbEjiDQ2nYReubkP
* About to connect() to host (#0)
*   Trying 1.2.3.4... connected
* Connected to host (1.2.3.4) (#0)
> POST /v1/users/login.json?key=vjCQ6KRqplmkektlpbEjiDQ2nYReubkP HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: <%= "#{@api_url}"%>
> Accept: */*
> Content-Length: 259
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------e6e42e31228c
> 
* Done waiting for 100-continue
< HTTP/1.1 200 OK 
< X-Ua-Compatible: IE=Edge
< Access-Control-Allow-Headers: x-requested-with
< Etag: "9eeb8ecc4fd905ab6b340c290f24ea0f"
< Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS
< Connection: Keep-Alive
< Content-Type: application/json; charset=utf-8
< Date: Mon, 16 May 2011 04:56:58 GMT
< Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
< X-Runtime: 1.681994
< Content-Length: 480
< Cache-Control: max-age=0, private, must-revalidate
< Access-Control-Allow-Credentials: true
* Added cookie _session_id="4dd0ae9ad0afbe183300001c" for domain localhost, path /, expire 0
< Set-Cookie: _session_id=4dd0ae9ad0afbe183300001c; path=/; HttpOnly
< 
{
  "meta": {
    "stat":"ok",
    "code":200,
    "method":"loginUser",
    "session_id":"4dd0ae9ad0afbe183300001c"
  },
  "response": {
    "users": [
      {
        "id":"4dc6334fd0afbe3700000001",
        "first_name":"Mike",
        "last_name":"Goff",
        "created_at":"2011-05-08T06:08:15+0000",
        "updated_at":"2011-05-16T04:56:58+0000",
        "facebook_authorized":false,
        "email":"mike@appcelerator.com"
      }
    ]
  } 
}

Uploading photos

The create (POST) and update (PUT) methods for many objects such as UsersCheckins, and Photos take an optional photo or file parameter to send a photo. The binary data must be sent in a form with Content-Type multipart/form-data, and the content type of the photo or file must beimage/jpegimage/png, or image/gif.

...

Table Cell (td)
Code Block
languagejs
$ curl --verbose -b cookies.txt -c cookies.txt -F "photo=@photo.jpg" -F "message=At the beach" 
https://api.cloud.appcelerator.com/v1/statuses/create.json?key=<API_KEY>

Object IDs

All returned data objects contain unique IDs which are 24-digit hexadecimal strings. These IDs may be use to efficiently return data for a single object:

Table Cell (td)
Code Block
linenumberstrue
languagejs
GET https://api.cloud.appcelerator.com/v1/places/show/**4d6f13e96f70953608000012**.json?key=<API_KEY>

{
  "meta": {
    "stat":"ok",
    "code":200,
    "method":"showPlace"
  },
  "response": {
    "places": [
      {
          "id":"4d6f13e96f70953608000012",
          "name":"Maya Restaurant",
          "created_at":"2011-03-03T04:07:05+0000",
          "updated_at":"2011-03-03T04:07:05+0000",
          "address":"303 2nd Street",
          "city":"San Francisco",
          "state":"CA",
          "country":"United States",
          "phone":"(415) 543-2928",
          "lat":37.784732,
          "lng":-122.395441 
      }
    ]
  } 
}

Response paging

Note

For  query  operations, the  page  and  per_page  paging mechanism described below only applies to applications created before ArrowDB 1.1.5. For applications created with ArrowDB 1.1.5 and later, you must use range-based queries, as discussed in  Query Pagination .

API calls which return arrays of objects take optional page and per_page arguments to specify the number of objects to return. By default, ten objects are returned on each page, and the request may specify up to 20 results per page. Page numbers start at 1; if unspecified, the page defaults to page 1.

...