2012-11-05 220 views
0

我在一個批處理請求後的樣子:返回JSON數據

<feed xmlns='http://www.w3.org/2005/Atom' 
xmlns:media='http://search.yahoo.com/mrss/' 
xmlns:batch='http://schemas.google.com/gdata/batch' 
xmlns:yt='http://gdata.youtube.com/schemas/2007'> 
<batch:operation type='query'/> 
<entry> 
<id>http://gdata.youtube.com/feeds/api/users/ytUser1</id> 
</entry> 
<entry> 
<id>https://gdata.youtube.com/feeds/api/users/ytUser2</id> 
</entry> 
<entry> 
<id>https://gdata.youtube.com/feeds/api/users/ytUser3</id> 
</entry> 
</feed> 

當然除了與實際用戶和更多的人的。我得到的XML返回罰款。有沒有辦法使用POST請求JSON格式的數據?我知道在GET請求中使用?alt = json會返回json,但這是可能的嗎?如果是這樣,在POST批處理請求中如何?

+0

嗨,我有同樣的麻煩。我想用JSON做出迴應。你有沒有找到任何方法? – eHussain

回答

0

您應該可以將alt = json添加到您發送POST的URL中。這通常適用於POST請求,也就是說,您可以發送POST來創建播放列表條目,並在您POST的URL中包含alt = json,並以JSON取回響應正文。如果它不適用於批量POST請求,我會感到驚訝。

+0

你的意思是鏈接,如http://gdata.youtube.com/feeds/api/videos/batch?alt=json但它不起作用 –