Server

Navigation:  Development > Web Service >

Server

Previous pageReturn to chapter overviewNext page

Web Service Helper used to create new API in the system. We define all API function in below location:
 
/development/helper/api

 
Following steps required to create an API

 

1.First create a class inside "api" folder.

2.Define a new method inside the class

3.Define input and output parameter of the function as a comments at to top of the function

4.Then share the WSDL URL of the method

5.Done

 

For an example:

1.Create a new file testservice.php in /development/helper/api. Open the file and create below class.
 
class Development_Helper_Api_testService{
 
}
 
Class name must followed by path according to Class and Objects conventions.
 

2.Create a new method  and define perimeters in comment
 
/**
* @param string
* @return integer
*/
public function getMyTime($date = NULL){
  return (string)strtotime($date);
}
 
@param define input parameter type. In the example we have define  the function to receive string type argument
@return define return type of the function. In the example API expect an integer value in return of it.
 

3.Now our API is ready to deliver. Share following WSDL to call  the method
 
http://www.example.com/developer/webservice/testservice/wsdl