eaglewu
eaglewu

Reputation: 470

What's mean of the API style that matching symbols?

The special matching symbols in API url eg: {?name} , {/other_user}

How to deal with clients?

Why use it ?

Reference:

https://api.github.com/repos/boot2docker/boot2docker/releases

Example:

{
"upload_url": "https://uploads.github.com/repos/boot2docker/boot2docker/releases/1161957/assets{?name}", 
"id": 1161957,
"tag_name": "v1.6.0",
"author": {
    "following_url": "https://api.github.com/users/tianon/following{/other_user}",
    "gists_url": "https://api.github.com/users/tianon/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/tianon/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/tianon/subscriptions",
    "organizations_url": "https://api.github.com/users/tianon/orgs",
    "repos_url": "https://api.github.com/users/tianon/repos",
    "events_url": "https://api.github.com/users/tianon/events{/privacy}",
}
}

Upvotes: 0

Views: 37

Answers (1)

jasonrudolph
jasonrudolph

Reputation: 593

They're URI templates. The GitHub API documentation includes examples demonstrating the benefits of using these templates.

The GitHub API documentation uses the Ruby uri_template library in its examples. While uri_template is a Ruby gem, you can find URI template libraries for most popular programming languages. This wiki (or a quick Google search) will probably help you find a URI template library for your language of choice.

Upvotes: 1

Related Questions