Skip to content

Commit

Permalink
Add usage example to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vtourraine committed Apr 3, 2013
1 parent 75fec09 commit 6370e68
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,27 @@
> _This is still in early stages of development, so proceed with caution when using this in a production application.
> Any bug reports, feature requests, or general feedback at this point would be greatly appreciated._
SZNAltmetric is a [Altmetric API](http://api.altmetric.com) client for iOS and Mac OS X. It’s built on top of [AFNetworking](http://www.github.com/AFNetworking/AFNetworking) to deal with network operations.
SZNAltmetric is an [Altmetric API](http://api.altmetric.com) client for iOS and Mac OS X. It’s built on top of [AFNetworking](http://www.github.com/AFNetworking/AFNetworking) to deal with network operations.

## Example Usage

We wanted to make it as simple as possible to fetch details about an article from the API, so here is how it looks like:

```objectivec
// Let’s specify an API key (optional)
SZNAltmetricAPIClient *client = [SZNAltmetricAPIClient sharedClient];
client.APIKey = @"###abc123###";

// Okay, now let’s fetch some data
[client fetchArticleWithDOI:@"###DOI###"
success:^(SZNAltmetricArticle *article) {
// We have the article,
// we can log the Altmetric score
NSLog(@"%@", [article.score stringValue]);
} failure:nil];
```
As you can see, we have just requested an article based on its DOI (you can also use Altmetric ID, PubMed ID, arXiv ID, and ADS Bibcode). What you get is a `SZNAltmetricArticle` object, containing all the identifiers, the Altmetric score, and even the URLs to the “donuts” images.
## Credits
Expand Down

0 comments on commit 6370e68

Please sign in to comment.