2011-04-16 57 views

回答

3

我用小提琴手做POST像你描述的,这个问题的URL,就像这样:

POST /urlshortener/v1/url HTTP/1.1 
User-Agent: Fiddler 
Content-Type: application/json 
Host: www.googleapis.com 
Content-Length: 102 

{"longUrl" : "http://stackoverflow.com/questions/5683562/formatting-url-to-generate-goo-gl-short-url"} 

,我得到了响应,

HTTP/1.1 200 OK 
ETag: "7EqIPxWjdFEMGopn0m-wh5UjU2M/mbXotpNse1SbcCFgA5pLLsB6hi4" 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate 
Pragma: no-cache 
Expires: Fri, 01 Jan 1990 00:00:00 GMT 
Date: Sat, 16 Apr 2011 01:13:41 GMT 
Content-Type: application/json; charset=UTF-8 
X-Content-Type-Options: nosniff 
X-Frame-Options: SAMEORIGIN 
X-XSS-Protection: 1; mode=block 
Server: GSE 
Content-Length: 164 

{ 
"kind": "urlshortener#url", 
"id": "http://goo.gl/Ztc9b", 
"longUrl": "http://stackoverflow.com/questions/5683562/formatting-url-to-generate-goo-gl-short-url" 
} 

这将是一个包含缩短网址的JSON表示。

+0

我想重新创建这个电子表格使用goo.gl,任何想法? http://blog.bit.ly/post/62001761/bit-ly-meets-google-spreadsheets-using-the-new – Kyle 2011-04-16 01:27:52

+1

@Kyle你知道如何做一个HTTP请求来检索电子表格,如果是的话,你知道什么格式你回来吗? – 2011-04-16 01:56:34