问题
So I was listening to Pandora at work, and was like, Man, it would be really cool to get the station list of Pandora, or interact with it remotely in some capacity..
So I found this unofficial Pandora API which just returns a bunch of JSON objects which look pretty helpful and neat! Here is the link to the API: http://pan-do-ra-api.wikia.com/wiki/Json/5
The problem is I have never really used JSON and definitely never used this API so I am not sure how to go about doing things. I think that if someone gave me an example of how to say get the station list from my windows 7 desktop computer that would be really helpful and I could probably get the rest from there.
Thanks!
回答1:
Again, with the comments from Marc B, I somewhat agree. However, to more generically answer your question- it's probably not worth your time.
Pandora request / response bodies are all sent over HTTP/HTTPS. However, they are all encrypted. There is a "public" list of keys you can use to encrypt and decrypt the responses. Once you have sorted all of that out, you'll have to use the APIs.
First you have to authenticate the user to get an Auth token. From there, you can access the APIs which require the auth tokens.
To your final point, JSON interfaces work in lots of different ways. Sometimes the API is specified through the URL itself like http://example.com/json/foo
Other times, it's specified in the request body through a POST.
If you really want to figure this out, I would play with it. I doubt anybody will post code on how to manipulate an API that isn't really "public". Pandora changes it somewhat frequently to purposefully break third party applications.
A simple JSON example:
POST to http://example.com/json/foo
{ param: "val",
anotherParam: "val",
responseType: "XML" }
Response might look like
{ status: 200,
result: "you called the foo API" }
来源:https://stackoverflow.com/questions/17049578/making-json-calls-to-unoffical-pandora-api