Home > Uncategorized > #Nuget #Package for #WordPress.com #API

#Nuget #Package for #WordPress.com #API

6I3oEOP4

If you want to automate processes based on the WordPress API – especially in situations where you want to do so without user interaction (i.e. server side / unattended / without oAuth), and you know C# / .NET, then this nuget package is for you.

First, you install the package via Nuget package manager;

Install-Package WordPressAPI 

Then, in order to authenticate yourself against WordPress,  You will need a wordpress username, password, and blog ID.  Get your Blog ID by going to https://developer.wordpress.com/docs/api/console/ then Login and search /me/sites or /sites/hello.wordpress.com

And here is a simple code example

var strAccessToken = WordPressComAPI.Wordpress.Login(new WordPressComAPI.Wordpress.Credentials
{
	Username = xxxxxx,
	Password = xxxxxx,
	blogId = xxxxx
});
var strSite = https://public-api.wordpress.com/rest/v1.1/sites/blog.dotnetframework.org;
var jSite = WordPressComAPI.Wordpress.Get(strSite,strAccessToken);
Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: