Como um desenvolvedor pode criar aplicativos e adicioná-los à Amigos Adventistas, aproveitando a base de usuários existentes. Você pode hospedar o aplicativo, o que significa que você controla completamente as especificações no seu servidor.
Criação de um Applicativo
Para interagir com Amigos Adventistas sua aplicação pode emitir as chamadas para a nossa API e solicitar ou postar informações.Quando você adiciona um aplicativo para nosso site nós lhe daremos um APP ID.
Solicitando um Token
Sempre que você planejar usar nossa API você deve primeiro solicitar um token. Para solicitar um token você precisa de uma chave única que enviamos para você quando um usuário visita seu APP a partir de um iframe no nosso site. Nós o repassamos como $_GET['key'].
Este é um exemplo de como você pode requisitar um token:
http://www.amigosadventistas.com.br/token.php?key=$_GET['key']
Se for bem sucedido, você receberá uma resposta JSON conforme abaixo::
Object
(
[token] => LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUc4d0RRWUpLb1pJaHZjTkFRRUJCUUFEWGdBd1d3SlVBdHFZdmVWOXFEdDd6NFhXTXYzS3VZM2JyWXpUKzR0VgpBbERrN1dQWjhqRVpoVzBNWjE1Z3lHdGNlNm5ueFRNenp4SXpHM29BRVIzc0JVRCtYdStHb21JeVV4UE1RN1NtCkVPdFg0ZTNwekp6R081cUxBZ01CQUFFPQotLS0tLUVORCBQVUJMSUMgS0VZLS0tLS0K
)
Envio de uma solicitação
Agora que você tem um token válido, você pode fazer solicitações para o nosso servidor. Com cada solicitação, você deve passar o token que criamos para você.
Abaixo segue um exemplo da chamada para nosso servidor API:
http://www.amigosadventistas.com.br/api.php?token=#{TOKEN}&method=#{METHOD_NAME}
Compreendendo uma Resposta API
Para métodos que poderiam retornar mais que um ítem, a resposta conterá um indicador do total de ítens disponíveis, assim como quantas páginas existem. Por padrão nós retornamos no máximo 10 ítens, para conseguir os próximos 10 ítens você teria que passaro parametro "page=2".
Para a esquerda você encontrará uma lista dos módulos que implementam métodos API. Clique no módulo e você verá uma lista dos métodos que o aplicativo pode usar. Para efeitos de formatação nós não incluimos a requisição completa lá, mas apenas as partes mais relevantes.
friend
getFriends
GET /api.php?method=friend.getFriends&user_id=#{USER_ID}
Gets a full list of friends for a specific user. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 1
[pages] => 0
[current_page] => 0
)
[output] => Array
(
[0] => Object
(
[user_id] => 7
[user_name] => jane-doe
[full_name] => Jane Doe
[joined] => 1314110027
[country_iso] => US
[gender] => Female
[photo_50px] => http://www.amigosadventistas.com.br/file/pic/user/7_50.jpg
[photo_50px_square] => http://www.amigosadventistas.com.br/file/pic/user/7_50_square.jpg
[photo_120px] => http://www.amigosadventistas.com.br/file/pic/user/7_120.jpg
[photo_original] => http://www.amigosadventistas.com.br/file/pic/user/7.jpg
[profile_url] => http://www.amigosadventistas.com.br/index.php?do=/jane-doe/
)
)
)
isFriend
GET /api.php?method=friend.isFriend&user_id=#{USER_ID}&friend_user_id=#{FRIEND_USER_ID}
Checks if 2 users are friends or not. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 0
[pages] => 0
[current_page] => 0
)
[output] => Object
(
[is_friend] => 1
)
)
mail
getNewCount
GET /api.php?method=mail.getNewCount&user_id=#{USER_ID}
Get the total number of unseen messages. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 0
[pages] => 0
[current_page] => 0
)
[output] => 1
)
notification
getNewCount
GET /api.php?method=notification.getNewCount&user_id=#{USER_ID}
Get the total number of unseen notifications. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 5
[pages] => 0
[current_page] => 0
)
[output] => 5
)
get
GET /api.php?method=notification.get&user_id=#{USER_ID}
Get all of the users notifications. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 0
[pages] => 0
[current_page] => 0
)
[output] => Array
(
[0] => Object
(
[notification_id] => 3
[link] => http://www.amigosadventistas.com.br/john-doe/comment-id_1/
[message] => Jane Doe commented on your wall
[icon] => http://www.amigosadventistas.com.br/module/blog/static/image/default/default/activity.png
)
)
)
photo
addPhoto
POST /api.php?method=photo.addPhoto&photo=#{@FILE_PATH;TYPE=MIME_TYPE}&photo_name=#{BASE_FILE_NAME}
Uploads a photo on behalf of the user.
Response
Object
(
[api] => Object
(
[total] => 0
[pages] => 0
[current_page] => 0
)
[output] => Object
(
[original] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d.jpg
[75px] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d_75.jpg
[100px] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d_100.jpg
[150px] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d_150.jpg
[240px] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d_240.jpg
[500px] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d_500.jpg
[1024px] => http://www.amigosadventistas.com.br/file/pic/photo/2011/08/39740c5e356fdd6f66cfc973d4aebf6d_1024.jpg
)
)
getPhotos
GET /api.php?method=photo.getPhotos&user_id=#{USER_ID}
Get all the photos for a user. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 1
[pages] => 0
[current_page] => 0
)
[output] => Array
(
[0] => Object
(
[photo_100px] => http://www.amigosadventistas.com.br/file/pic/photo/c81e728d9d4c2f636f067f89cc14862c_100.jpg
[photo_240px] => http://www.amigosadventistas.com.br/file/pic/photo/c81e728d9d4c2f636f067f89cc14862c_240.jpg
[photo_original] => http://www.amigosadventistas.com.br/file/pic/photo/c81e728d9d4c2f636f067f89cc14862c.jpg
)
)
)
user
getUser
GET /api.php?method=user.getUser&user_id=#{USER_ID}
Get information about a user based on the user ID# you pass. If you do not pass the #{USER_ID} we will return information about the user that is currently logged in.
Response
Object
(
[api] => Object
(
[total] => 0
[pages] => 0
[current_page] => 0
)
[output] => Object
(
[user_id] => 1
[user_name] => john-doe
[joined] => 1314109907
[gender] => Male
[country_iso] => US
[full_name] => John Doe
[email] => john.doe@site.com
[photo_50px] => http://www.amigosadventistas.com.br/file/pic/user/2011/08/9d673759d1cf55c9cd0b0805dc32e68e_50.jpg
[photo_50px_square] => http://www.amigosadventistas.com.br/file/pic/user/2011/08/9d673759d1cf55c9cd0b0805dc32e68e_50_square.jpg
[photo_120px] => http://www.amigosadventistas.com.br/file/pic/user/2011/08/9d673759d1cf55c9cd0b0805dc32e68e_120.jpg
[photo_original] => http://www.amigosadventistas.com.br/file/pic/user/2011/08/9d673759d1cf55c9cd0b0805dc32e68e.jpg
[profile_url] => http://www.amigosadventistas.com.br/index.php?do=/john-doe/
)
)

Create an App
Português (BR)