Sitehoover API to interfejs umożliwiający integrację aplikacji zewnętrznych z usługą sitehoover.com. Sitehoover API bazuje na protokole JSON-RPC.
Żądania do API kierowane są na adres:
Sitehoover API Key to klucz autoryzacyjny wymagany przez każdą z metod Sitehoover API. Indywidualny Sitehoover API Key jest dostępny dla każdego zarejestrowanego użytkownika z poziomu panelu Ustawienia i zakładki Konto.
{
"id" : "1",
"method" : "ping",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"echo" : "my pong"
}
]
}
gdzie:
id – Dowolny identyfikator żądania.method – Nazwa wywoływanej metody.params – Parametry wywoływanej metody, przy czy pierwszym elementem tablicy parametrów jest zawsze Sitehoover API Key.{
"result": "my pong",
"error": null,
"id": "1"
}
gdzie:
result – Zwrócone dane.error – Status błędu:
null – Brak błędu.400 – Błędny wywołanie, np. nieprawidłowy format danych żądania lub brak wymaganych parametrów metody.403 – Błąd autoryzacji. Błędny Sitehoover API Key.404 – Wywoływana metoda nie istnieje.500 – Wewnętrzny błąd serwera.id – Identyfikator żądania.data.
Przydład (JavaScript):
var url = 'http://api.sitehoover.com/api/?data=' + escape(JSON.stringify(_request_json)) + '&jsoncallback=jsonp1268568693530';gdzie:
_request_json – Obiekt JSON żądania.Testuje połączenie z API.
JSON Request:{
"id" : "1",
"method" : "ping",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"echo" : "my pong" [OPTIONAL]
}
]
}
JSON Response:
{
"result": "my pong",
"error": null,
"id": "1"
}
Zwraca tablicę hooverów.
JSON Request:{
"id" : "1",
"method" : "get_hoovers",
"params" : [
YOUR_SITEHOOVER_API_KEY
]
}
JSON Response:
{
"result": [
{
"oid" : 423,
"name" : "Example hoover 1",
"path" : "example-hoover-1",
"thumb" : "",
"tags" : "development, api, php, json",
"public" : 1,
"main" : 1
},
{
"oid" : 1123,
"name" : "Example hoover 2",
"path" : "example-hoover-2",
"thumb" : "",
"tags" : "",
"public" : 0
"main" : 0
}
],
"error" : null,
"id" : "1"
}
Zwraca tablicę folderów w hooverze.
JSON Request:{
"id" : "1",
"method" : "get_folders",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"hoover_oid" : 4
}
]
}
JSON Response:
{
"result" : [
{
"oid" : 121,
"name" : "___main___",
"sortorder" : 0,
"main" : 1
},{
"oid" : 432,
"name" : "My folder name",
"sortorder" : 1,
"main" : 0
},{
"oid" : 1242,
"name" : "Second folder name",
"sortorder" : 2,
"main" : 0
}
],
"error" : null,
"id" : "1"
}
Dodaje folder do hoovera.
JSON Request:{
"id" : "1",
"method" : "add_folder",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"hoover_oid" : 4,
"name" : "New folder",
"sortorder" : 0 [OPTIONAL]
}
]
}
JSON Response:
{
"result" : 2355,
"error" : null,
"id" : "1"
}
Edytuje folder.
JSON Request:{
"id' : "1",
"method" : "edit_folder",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"oid" : 10,
"name" : "new name",
"sortorder": 1 [OPTIONAL]
}
]
}
JSON Response:
{
"result" : true,
"error" : null,
"id" : "1"
}
Usuwa folder.
JSON Request:{
"id" : "1",
"method" : "delete_folder",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"oid" : 7
}
]
}
JSON Response:
{
"result" : true,
"error" : null,
"id" : "1"
}
Zwraca tablicę stron w folderze.
JSON Request:{
"id" : "1",
"method" : "get_pages",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"folder_oid" : 9
}
]
}
JSON Response:
{
"result": [
{
"oid" : "128",
"title" : "Another title of Yahoo!",
"url" : "http://www.yahoo.com/",
"thumb" : "https://thumbs.w3media.pl/thumbs/2f9704c729e7ed3b41647b7d0ad649fe,1,5.jpg",
"note" : "sample note",
"rss" : "http://sports.yahoo.com/olympics/rss.xml",
"sortorder" : "1"
},{
"oid" : "229",
"title" : "Simply google",
"url" : "http://www.google.com/",
"thumb" : "https://thumbs.w3media.pl/thumbs/3e4c44d9f192da3bcf0c1ece96717408,1,5.jpg",
"note" : "",
"rss" : "",
"sortorder" : "2"
}
],
"error":null,
"id":"1"
}
Dodaje stronę do folderu.
JSON Request:{
"id" : "1",
"method" : "add_page",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"folder_oid" : 9,
"url" : "http://www.web-album.org",
"title" : "My page title", [OPTIONAL]
"rss" : "http://www.web-album.org/pl/rss-last-photos/", [OPTIONAL]
"note" : "my note", [OPTIONAL]
"sortorder" : 1 [OPTIONAL]
}
]
}
JSON Response:
{
"result" : 2134,
"error" : null,
"id" : "1"
}
Edytuje stronę.
JSON Request:{
"id" : "1",
"method" : "edit_page",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"oid" : 2134,
"folder_oid" : 8, [OPTIONAL]
"title" : "My new page title", [OPTIONAL]
"rss" : "http://www.web-album.org/pl/rss-last-comments/", [OPTIONAL]
"note" : "my new note", [OPTIONAL]
"sortorder" : 1 [OPTIONAL]
}
]
}
JSON Response:
{
"result" : true,
"error" : null,
"id" : "1"
}
Usuwa stronę.
JSON Request:{
"id" : "1",
"method" : "delete_page",
"params" : [
YOUR_SITEHOOVER_API_KEY, {
"oid" : 3
}
]
}
JSON Response:
{
"result" : true,
"error" : null,
"id" : "1"
}