How to use GNU Social API

This guide will help you understand GNU Social's API and make a simple application.

Download and install GNU social

 * Download latest GNU social release from [[http://gnu.io/social/resources/code/|here]].
 * [[Installing GNU social]]

Write Simple Application

This example is from the API documentation.

 * Open a commandline (terminal)
 * Familiarize yourself with CURL
 * Confirm you have an internet connection
 * Run this command by replacing username and password with your GNU Social username and password. Also replace example.com with your GNU Social installation such as https://gnusocial.de/api/statuses/update.xml
  curl -u username:password http://example.com/api/statuses/update.xml -d status='Howdy!' -d lat='30.468' -d long='-94.743'
* You should receive a similar response to the one below:

 <?xml version="1.0" encoding="UTF-8"?>
 <status xmlns:statusnet="http://status.net/schema/api/1/">
  <text>Howdy!</text>
  <truncated>false</truncated>
  <created_at>Sat Jan 17 13:40:21 +0000 2015</created_at>
  <in_reply_to_status_id></in_reply_to_status_id>
  <source>api</source>
  <id>841735</id>
  <in_reply_to_user_id></in_reply_to_user_id>
  <in_reply_to_screen_name></in_reply_to_screen_name>
  <geo></geo>
  <favorited>false</favorited>
  <user>
   <id>2912</id>
   <name>Dalai Lama</name>
   <screen_name>dalailama</screen_name>
   <location></location>
   <description></description>
   <profile_image_url>http://oracle.skilledtests.com/avatar/2912-48-20131126003451.jpeg</profile_image_url>
   <url>http://en.wikipedia.org/wiki/Dalai_Lama</url>
   <protected>false</protected>
   <followers_count>2</followers_count>
   <friends_count>2</friends_count>
   <created_at>Tue Nov 26 00:30:25 +0000 2013</created_at>
   <favourites_count>0</favourites_count>
   <utc_offset>0</utc_offset>
   <time_zone>UTC</time_zone>
   <statuses_count>17</statuses_count>
   <following>true</following>
   <statusnet:blocking>false</statusnet:blocking>
   <notifications>true</notifications>
   <statusnet:profile_url>http://oracle.skilledtests.com/dalailama</statusnet:profile_url>
  </user>
  <statusnet:html>Howdy!</statusnet:html>
  <statusnet:conversation_id>496129</statusnet:conversation_id>
 </status>

Notice: If your apache does not have „Fancy URLs“ enabled, the example url's from above need to change. (e.g. http://example.com/api/statuses/update.xml becomes http://example.com/index.php/api/statuses/update.xml )

Notice: If you are using curl to upload media files, use -F (–form) rather than -d in order to set the content-type header to „multipart/form-data“.

Advanced information

 * [[GNU social API discovery|API discovery]]

//This page is available under the CC BY license, contents taken from skilledtests.com//