Skip to content

Commit 5138489

Browse files
author
Bryan Berg
committed
Merge branch 'new-docs' of git.int.sfo01.mml:mxml/api-spec into new-docs
2 parents 94d2613 + 8e4bd50 commit 5138489

File tree

21 files changed

+147
-41
lines changed

21 files changed

+147
-41
lines changed

content/reference/authentication/flows/app-access-token.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,23 @@ with URL-encoded POST body:
1919
&client_secret=[your client secret]
2020
&grant_type=client_credentials
2121

22-
> Note: we also accept the `client_id` and `client_secret` parameters via the Authorization header, as described in [section 2.3.1 of the spec](http://tools.ietf.org/html/rfc6749#section-2.3.1).
22+
Example:
23+
24+
<%= curl_example(:post, "access_token", :none, {
25+
:subdomain => "account",
26+
:path_prefix => "/oauth/",
27+
:pretty_json => false,
28+
:token => nil,
29+
:content_type => nil,
30+
:data => {
31+
"grant_type" => "client_credentials",
32+
"client_id" => "[your client_id]",
33+
"client_secret" => "[your client secret]",
34+
}
35+
}) %>
36+
37+
38+
> We also accept the `client_id` and `client_secret` parameters via the Authorization header, as described in [section 2.3.1 of the OAuth 2 spec](http://tools.ietf.org/html/rfc6749#section-2.3.1).
2339
2440
App.net will respond with a JSON-encoded token:
2541

content/reference/authentication/flows/password.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,27 @@ Once you have been approved, using the password flow is pretty straightforward:
4949
&password=[user's password]
5050
&scope=[scopes separated by spaces]
5151

52-
> The use of `password_grant_secret` diverges from the OAuth 2.0 specificaion. `password_grant_secret` is a special token that we'll send you when your use of the password flow is approved.
53-
54-
> **You can require app-specific passwords** by providing a `require_app_specific_password=1` URL parameter. **[Two-Factor Auth users](http://blog.app.net/2013/03/13/added-security-for-your-app-net-account/) must use app-specific passwords** irrespective of this parameter. We strongly encourage the use of app-specific passwords by all users as they significantly increase account security.
52+
Example:
53+
54+
<%= curl_example(:post, "access_token", :none, {
55+
:subdomain => "account",
56+
:path_prefix => "/oauth/",
57+
:pretty_json => false,
58+
:token => nil,
59+
:content_type => nil,
60+
:data => {
61+
"grant_type" => "password",
62+
"client_id" => "[your client_id]",
63+
"password_grant_secret" => "[your password grant secret that was emailed to you]",
64+
"username" => "[user's email address or username]",
65+
"password" => "[user's password]",
66+
"scope" => "[scopes separated by spaces]",
67+
}
68+
}) %>
69+
70+
> The use of `password_grant_secret` diverges from the OAuth 2.0 specification. `password_grant_secret` is a special token that we'll send you when your use of the password flow is approved.
71+
72+
> **You can require app-specific passwords** by providing a `require_app_specific_password=1` URL parameter. **[Two-Factor Auth users](http://blog.app.net/2013/03/13/added-security-for-your-app-net-account/) must use app-specific passwords** regardless of this parameter. We strongly encourage the use of app-specific passwords by all users as they significantly increase account security.
5573
5674
1. If the authorization was successful, App.net will respond with a JSON-encoded token:
5775

content/reference/authentication/flows/web.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,24 @@ Your `redirect_uri` must be registered with App.net before you can use it.
4545
&redirect_uri=[your registered redirect URI]
4646
&code=[code received from redirect URI]
4747

48-
> Note: we also accept the `client_id` and `client_secret` parameters via the Authorization header, as described in [section 2.3.1 of the spec](http://tools.ietf.org/html/rfc6749#section-2.3.1).
48+
Example:
49+
50+
<%= curl_example(:post, "access_token", :none, {
51+
:subdomain => "account",
52+
:path_prefix => "/oauth/",
53+
:pretty_json => false,
54+
:token => nil,
55+
:content_type => nil,
56+
:data => {
57+
"grant_type" => "authorization_code",
58+
"client_id" => "[your client_id]",
59+
"client_secret" => "[your client secret]",
60+
"redirect_uri" => "[your registered redirect URI]",
61+
"code" => "[code received in the previous step]"
62+
}
63+
}) %>
64+
65+
> We also accept the `client_id` and `client_secret` parameters via the Authorization header, as described in [section 2.3.1 of the OAuth 2 spec](http://tools.ietf.org/html/rfc6749#section-2.3.1).
4966
5067
1. App.net will respond with a JSON-encoded token: `{"access_token": "[user access token]", "token": {...Token object...}}`
5168

content/reference/authentication/identity-delegation.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ Intentionally not addressed in this document are the following:
4545

4646
> For App.net, the OAuth token endpoint is: `https://account.app.net/oauth/access_token`
4747
48+
Example:
49+
50+
<%= curl_example(:post, "access_token", :none, {
51+
:subdomain => "account",
52+
:path_prefix => "/oauth/",
53+
:pretty_json => false,
54+
:content_type => nil,
55+
:data => {
56+
"grant_type" => "delegate",
57+
"delegate_client_id" => "[your client_id]",
58+
}
59+
}) %>
60+
61+
4862
1. The authorized client makes a request to the delegate client with two additional headers, `Identity-Delegate-Token` and `Identity-Delegate-Endpoint`:
4963

5064
POST /protected/resource HTTP/1.1
@@ -60,7 +74,26 @@ Intentionally not addressed in this document are the following:
6074

6175
> The delegate token and delegate endpoint may also be sent as delegate_token and delegate_endpoint in the query string or POST body.
6276
63-
1. The delegate client identifies the resource server by using the `Identity-Delegate-Endpoint` header and makes a request to that endpoint with the Authorization header set.
77+
Example:
78+
79+
<%= curl_example(:post, "protected/resource", :none, {
80+
:subdomain => "delegate-client",
81+
:domain => "example.com",
82+
:path_prefix => "/",
83+
:pretty_json => false,
84+
:content_type => nil,
85+
:token => nil,
86+
:headers => {
87+
"Identity-Delegate-Token" => "[delegate_token from previous step]",
88+
"Identity-Delegate-Endpoint" => "https://alpha-api.app.net/stream/0/token",
89+
},
90+
:data => {
91+
"do_some_stuff" => "1",
92+
"fo_reals" => "1",
93+
}
94+
}) %>
95+
96+
1. The delegate client identifies the resource server (App.net) by using the `Identity-Delegate-Endpoint` header and makes a request to that endpoint with the Authorization header set.
6497

6598
> The query string parameters `delegate_token`, `client_id` and `client_secret` may be used in place of HTTP headers if desired.
6699
@@ -100,12 +133,22 @@ Intentionally not addressed in this document are the following:
100133
}
101134
}
102135

103-
The resource server replies with an implementation-dependent description of the current user, which must include the client_id the authorized client. In the case of App.net, this is the Token object of the authorizing client's access_token as returned by the [Retrieve current Token](/reference/resources/token/#retrieve-current-token) endpoint.
136+
App.net replies with information about the authorized delegate token. This is the Token object of the authorizing client's access_token as returned by the [Retrieve current Token](/reference/resources/token/#retrieve-current-token) endpoint.
104137

105138
The delegate client may verify that the authorized client matches some external authentication scheme and/or list of authorized applications. If the delegate token is not valid for the delegate client's client_id, this call will return a `401 Unauthorized`.
106139

107140
> For App.net, the identity delegation endpoint is: `https://alpha-api.app.net/stream/0/token`
108141
142+
Example:
143+
144+
<%= curl_example(:get, "token", :none, {
145+
:pretty_json => false,
146+
:headers => {
147+
"Authorization" => "Basic [base64(client_id + ':' + client_secret)]",
148+
"Identity-Delegate-Token" => "[delegate_token]",
149+
},
150+
}) %>
151+
109152
## Notes
110153

111154
1. `delegate_token`s are valid as long as their associated `access_token`s are valid.

content/reference/authentication/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ When making a call to one of our API resources, there are three ways to include
133133

134134
* Add `access_token` to query string
135135

136-
<%= curl_example(:get, "posts/1?access_token=<YOUR ACCESS TOKEN>", :none, {:data => "text=Test post", :content_type => nil, :token => nil}) %>
136+
<%= curl_example(:get, "posts/1?access_token=<YOUR ACCESS TOKEN>", :none, {:data => {"text" => "Test post"}, :content_type => nil, :token => nil}) %>
137137

138138
* Add `access_token` to HTTP body.
139139

140-
> Note: this method will only work with the `PUT`, `POST`, and `PATCH` methods. `GET` and `DELETE` do not accept an HTTP body.
140+
> This method will only work with the `PUT`, `POST`, and `PATCH` methods. `GET` and `DELETE` do not accept an HTTP body.
141141
142142
<%= curl_example(:post, "posts", :none, {
143143
:data => {"text" => "Test post", "access_token" => "<YOUR ACCESS TOKEN>"},

content/reference/make-request/responses.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: "Responses"
99

1010
All responses to requests to the App.net API endpoints listed under [Resources](/reference/resources/), whether successful or not, will be returned in the same type of envelope structure. This document describes how that envelope works and what it may contain.
1111

12-
*Please note: the [authentication endpoints](/reference/authentication) return a slightly different format that follows the OAuth2 specification.*
12+
*The [authentication endpoints](/reference/authentication) return a slightly different format that follows the OAuth2 specification.*
1313

1414
## Response Envelope
1515

@@ -63,7 +63,7 @@ To request pretty-printing, send the following HTTP header with your request:
6363

6464
X-ADN-Pretty-JSON: 1
6565

66-
*Note: Sending any value is sufficient. Omit the header entirely if you wish to receive minified JSON.*
66+
Sending any value is sufficient. Omit the header entirely if you wish to receive minified JSON.
6767

6868
## Error Conditions
6969

content/reference/meta/entities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Usually entities are extracted from the Post text by App.net's servers. We allow
1313

1414
Ranges specified by entities may be adjacent, but may not overlap.
1515

16-
<div class="alert alert-info"><b>Note:</b> <code>pos</code> and <code>len</code> fields are given as UTF-32 code points. Many string implementations (in particular, Cocoa's NSString class and Javascript's strings) use UTF-16 or UCS-2 encoding internally, and thus the indices given will not map directly to UTF-16 code points if encoded with surrogate pairs, e.g., emoji characters.</div>
16+
<div class="alert alert-info"><code>pos</code> and <code>len</code> fields are given as UTF-32 code points. Many string implementations (in particular, Cocoa's NSString class and Javascript's strings) use UTF-16 or UCS-2 encoding internally, and thus the indices given will not map directly to UTF-16 code points if encoded with surrogate pairs, e.g., emoji characters.</div>
1717

1818
All of the following examples are about the following text:
1919

content/reference/other/feeds.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ There are 2 different kinds of feeds, but they all follow the same pattern:
1818

1919
We intend to support more feed formats and richer support for filters in the near future.
2020

21-
*Note:* While the URLs are similar to other API URLs feeds, they are under a different root.
21+
While the URLs are similar to other API URLs feeds, they are under a different root.
2222

2323
## Filters
2424

content/reference/other/web-intents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Web intents are an easy way to integrate with App.net; you don't even need to us
1111

1212

1313
<div class="alert alert-info alert-block">
14-
<p><strong>Note:</strong> If you just want a simple follow or share button you can use <a href='http://app.net/about/buttons/'>button builder</a> instead. We've also open sourced the buttons so that you could host them your self. Checkout the <a href="https://github.com/appdotnet/piha">github repo</a> for more information on how to do that.</p>
14+
<p>If you just want a simple follow or share button you can use <a href='http://app.net/about/buttons/'>button builder</a> instead. We've also open sourced the buttons so that you could host them your self. Checkout the <a href="https://github.com/appdotnet/piha">github repo</a> for more information on how to do that.</p>
1515
</div>
1616

1717
## The Post Intent

content/reference/resources/channel/search.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ title: "Channel Search"
1111

1212
Returns [Channel](/reference/resources/channel/) objects which match a given search query. Because channels have no inherent notion of description or name, we take textual data from common channel annotations which contain such fields, e.g. <code>net.patter-app.settings</code>. We also allow filtering on specific channel properties, such as channel type. No matter what query data is supplied, the search results will respect channel ACLs, and results are limited to non-private channels if the requesting access token does not have the <code>messages</code> scope.
1313

14-
<%= general_params_note_for "channel" %> Note: Pagination works for all orderings on this endpoint. Be sure to make requests with before_id=min_id or since_id=max_id as usual when paginating the popularity-sorted results. Separate lists of terms by spaces.
14+
Separate lists of terms by spaces.
15+
16+
<%= general_params_note_for "channel" %>
1517

1618
<%= endpoint "GET", "channels/search", "User", "public_messages</code> or <code>messages" %>
1719

0 commit comments

Comments
 (0)