Denne siden er en del av blogg.no-support Kontakt support  |  Infobloggen  |  Forsiden

hjelp.blogg.no



For developers

Blogsoft Toppliste API

HVORDAN LAGE TOPPLISTER:

http://blogg.no/api/toplist?type=region&region=bømlo&limit=20
http://blogg.no/api/toplist?type=region&region=sauda&limit=20
http://blogg.no/api/toplist?type=region&region=suldal&limit=20

etc. Bare bytt ut kommunenavn:

http://blogg.no/api/toplist?type=region&region=lørenskog&limit=20

Man kan også slå sammen kommuner:

http://blogg.no/api/toplist?type=region&region=suldal,bømlo,sauda&limit=20





Blogsoft feed terms of use


Creative Commons-lisens

RSS feeds generert
av www.blogg.no er lisensiert under en Creative Commons Navngivelse-IkkeKommersiell-DelPåSammeVilkår 4.0 Internasjonal Lisens.
For kommersielle tjenester skal du bruke url http://bloggnavn.blogg.no/index2.rss.
Dersom du ønsker tillatelse til å bruke rss innholdet fra blogg.no som går utover ovenstående kan du kontakte oss og avtale dette spesielt.

RSS feeds generated by www.blogg.no are lisenced under a Attribution-NonCommercial-ShareAlike 4.0 International lisence.
For commercial services use url http://blogname.blogg.no/index2.rss.
If you need an extended lisence for use of content from blogg.no please contact us.

Blogsoft feed API

Description:
Returns json/jsonp/rss feed with latest articles. You can filter the feed with providing parameters.

Returns:
Returns a JSON or RSS feed.

API URL:
http://api.blogsoft.no/index.bd?fa=api2.call&method=getLastArticles&hashtag=&limit=&region=&jsonp=&feedType=

Parameters:

Parameter Description
method Api method getLastArticle will provide with latest articles.
hashtag Comma separated hashtags to filter article list.
limit Use numeric value to limit the article feed count.
region Comma separated region names to filter article list by regions.
jsonp Your jsonp function name.
feedType Mention your required feed type. To get a rss feed use feedType=rss. API default feed is Json.

Example:
http://api.blogsoft.no/index.bd?fa=api2.call&method=getLastArticles&hashtag=trening,mat&limit=5&region=oslo,moss&jsonp=foo
The example above will response with a json output. It is because no feedType is specified in the call and default feedType is json. Also the response will be wrapped up with a foo function.

http://api.blogsoft.no/index.bd?fa=api2.call&method=getLastArticles&hashtag=trening,mat&limit=5&region=oslo,moss&feedType=rss

The example above will response with a rss feed.


Blogsoft OAuth documentation

Blogsoft’s API uses the OAuth 2.0 protocol for authentication and authorization. OAuth 2.0 is a relatively simple protocol and developers can integrate with Blogsoft's OAuth 2.0 endpoints without too much effort. The one thing to keep in mind is that all requests to the API must be made over SSL (https:// not http://)


1. Register Application

All applications that access Blogsoft's API must be registered in Blogsoft. Please contact support (hjelp@blogg.no) to register your application. As a result of the registration process, you will get a set of values that are known to both Blogsoft and your application (e.g. client_id, client_secret,  redirect_uri, etc.).


2. Obtain an Access Token from the Blogsoft Authorization Server

Before your application can access a Blogsoft API behalf of a user, it must obtain an access token that grants access to that API. These tokens are unique to a user and should be stored securely. A single access token may grant varying degrees of access to multiple APIs. The set of resources and operations permitted by an access token is controlled during the access token request via a variable parameter called 'scope'. Several scopes may be included in a request.

 

In order to receive an access_token, you must do the following:

  1. Direct the user to our authorization url.
    • If the user is not logged in, they will be asked to log in.
    • The user will be asked if they’d like to give your application access to his/her Blogsoft data.
  2. The server will redirect the user to your redirect uri with code. Take the provided code parameter and exchange it for an access_token by POSTing the code to our access_token url.

Step One: Direct your user to our authorization URL

https://blogsoft.no/index.bd?fa=oauth.authorize&response_type=code&scope=SCOPE&client_id=CLIENT_ID&redirect_uri=REDIRECT_URI
  • scope:  The OAuth 2.0 spec allows you to specify the scope of the access you’re requesting from the user. If you’d like to request multiple scopes at once, simply separate the scopes by a comma. In the url, the parameter will look like this:scope=publish,read If you attempt to perform a request with an access token that isn’t authorized for that scope, you will receive an OAuthPermissionsException error return. 
  • client_id: your client id
  • redirect_uri: the redirect_uri you used in the authorization request.

 

At this point, we present the user with a login screen and then a confirmation screen where they approve your app’s access to his/her Blogsoft data. 

 

Step Two: Receive the redirect from Blogsoft

Once a user successfully authenticates and authorizes your application, we will redirect the user to your redirect_uri with a code parameter that you’ll use in step three.

http://your-redirect-uri?code=CODE

 

Step Three: Request the access_token

In the previous step, you’ll have received a code which you’ll have to exchange in order to receive an access_token for the user. In order to make this exchange, you simply have to POST this code, along with some app identification parameters to our access_token endpoint. Here are the required parameters:

  • client_id: your client id
  • client_secret: your client secret
  • grant_type: authorization_code is currently the only supported value
  • redirect_uri: the redirect_uri you used in the authorization request. Note: this has to be the same value as in the authorization request.
  • code: the exact code you received during the authorization step.

For example, you could request an access_token like so:

curl --data "code=YOUR_CODE&grant_type=authorization_code&client_id=CLIENT_ID&client_secret=CLIENT_SECRET" https://blogsoft.no/index.bd?fa=api2.token

 

If successful, this call will return a OAuth Token that you can use to make authenticated calls to the API.

{"access_token": "astsdfwersdsdfdsffsdfsdfsdfdsfsdf"}  

Note that we do not include an expiry time. Our access_tokens have no explicit expiry, though your app should handle the case that either the user revokes access or we expire the token after some period of time.

 


3. Make an API call

  • Publish a post: When a user choose to publish a post, you could request to blogg.no, like this

 POST http://blogsoft.no/index.bd?fa=api2.call&method=newPost&access_token=ACCESS_TOKEN&blogurl=BLOG_URL&title=POST_TITLE&body=POST_BODY&categoryid=CATEGORY_ID
  • access_token: user's access token
  • blogurl: user's blog url
  • title:  article title
  • body:article body
  • categoryid: category id