[DEPRECATED] Feng Office API Developer's Guide - Version 1

Feng Office API provides a powerful and simple Web Service interface to interact with your Feng Office installation. It's based on a RESTful and Stateless web service, over JSON Internet Media Type.

Base URI (or Endpoint) Endpoint URL: FENGOFFICE_URL/api

If your Feng Office installation is accessible by the following url: http://example.com/feng then your API endpont is: http://example.com/feng/api

This version counts with the following methods so that they can be invoked:

  • get_object
  • list_members
  • listing
  • save_object
  • trash
  • complete_task

To invoke a remote method you need to make a request to the following URL: http://example.com/feng/api/METHOD_NAME/&exampleParam=1

When invoking a service, the best way would be to create a handler first. Then, you would have to call it from the handler through the API client, where all the functions are going to be at:

Example of how to invoke the function completeTask while standing on the API client, and calling the API Controller in the core:

api_invocation_example.php
    /**
     * Complete Task passed as argument
     * If status = 1 : complete it. Otherwise repoen it
     * @param int $id
     */
    public function completeTask($id, $status = true) {
    	$action = ($status)?'complete':'reopen';
    	$request = $this->endPoint . '?auth=' . $this->hashCode . '&c=api&m=complete_task&id='.$id.'&action='.$action;
    	return $this->decode_response(HttpServices::doRequest($request), 'json');
    }

endPoint = URL where your Feng Office source code is at

NOTES:

  1. The URL must finish with a slash!!
  2. If your server has mod rewrite disabled, the url to invoke is:

http://example.com/feng/index.php?c=api&m=METHOD_NAME&exampleParam=1

Each web service request must include a GET parameter ‘auth’ containing a hash of the user password. This hash is the user token generated automatically when user is created.

The common parameters that must be included on each request: GET[version]: The version of the API Each method accepts different arguments from GET or POST depending on the implementation. Look at the method specifications for further information.

Name GET POST Return Description
get_object oid: integer - required object Retrieves all object information
list_members srv: member object type hander - required array Returns a list of members
trash id: integer - required boolean Trashes a given object
complete_task id: integer - required
action: string – 'complete' completes the tasks. Otherwise the task will be opened
boolean Completes the task
listing srv: object type handler – required
args: array
order_dir
order
members
rested_by_id
assigned_to status
array Generic list for Feng Office content objects
save_object srv: object type name – required args: array
id: optional - common
created_by_id – common
title – common
description - task
due_date - task
start_date - task
completed - task
assign_to - task
priority - task
assigned_to - task
status – task
text - note
boolean Edit a given object or create a new Object depending on the 'id' parameters

Message List: URL: http://example.com/feng/api/listing/&srv=ProjectMessages&auth=AUTH_HASH

RESPONSE:

[

{
  "id":15,
  "title":"Feng office message",
  "cbid":2,
  "cbname":"admin",
  "createdOn":1332526355,
  "text":"Message body goes here "
},
{
  "id":16,
  "title":"Another messege",
  "cbid":2,
  "cbname":"admin",
  "createdOn":1332526355,
  "text":"Bla bla bla bla bla bla..."
}

]