2015-09-27 153 views
0

我一直在想方法来使用Blogger API 3.0发布json数据。我有一个关于GET方法的想法,所以我能碰到一个URL读取JSON数据,但我有点困惑究竟如何,我可以做下面的请求JQuery-使用授权发布Post请求

Adding a post 

You can add a post for a blog by sending a POST request to the post collection URI with a post JSON body: 

POST https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/ 
Authorization: /* OAuth 2.0 token here */ 
Content-Type: application/json 

{ 
    "kind": "blogger#post", 
    "blog": { 
    "id": "8070105920543249955" 
    }, 
    "title": "A new post", 
    "content": "With <b>exciting</b> content..." 
} 
You must be authenticated to create a post. 

我有蜜蜂试图使用Blogger API 3这允许创建新的帖子。

裁判:http://code.blogger.com/2012/06/blogger-api-v3.html

更新:我有点好奇,如果同样的事情可以通过使用C#作为编程语言控制台应用程序来完成。

回答

0

要发送POST请求:

var post_data = { 
    "kind": "blogger#post", 
    "blog": {"id": "8070105920543249955"}, 
    "title": "A new post", 
    "content": "With <b>exciting</b> content..." 
} 

$.ajax({ 
    type: 'POST', 
    url: 'your_request_url_here', 
    dataType: 'JSON', 
    data: post_data, 
    complete: function(res) { 
     console.log(res); 
    } 
}) 
+0

我们如何通过'授权:/ *的OAuth 2.0令牌这里* /'? –