Classes should be named "ExtAPI<apiName>" and should be placed in the ./include/externalAPI/<apiName> directory (the directory name should be ./custom/include/externalAPI/<apiName> if this is externally created code) with the filename of "ExtAPI<apiName>.php". There can be other files located in the directory with your class and they will be ignored by the application, the external api class may use these for additional libraries, XML/XSL templates, or any other necessory file. In order for the new external API class to be picked up by the system, it is necessary to flush the external API cache of class names by going to the "Admin" module, selecting the "Repair" link and then selecting "Quick Repair and Rebuild", after this is complete any new external APIclasses that match the naming convention.
Classes based on OAuth methods for authentication and access control should extend the "OAuthPluginBase" class located at ./include/externalAPI/Base/OAuthPluginBase.php. Username and password based API’s should extend the "ExternalAPIBase" class located at ./include/externalAPI/Base/ExternalAPIBase.php. Classes should implement the ExternalAPIPlugin API, along with the WebDocument, WebFeed and/or WebMeeting API’s depending on their feature set. Classes may implement more than one of the WebDocument/WebFeed/WebMeeting API’s simultaneously and there should be only one external API class per 3rd party site so a user does not have to authenticate against the same site more than once.
Method calls almost always return an array containing at least a "success" element, if this element is true it can be assumed that the method call was successful. If the method returns a "success" value of false, an additional element of "errorMessage" must be set with a user-readable error message explaining the problem.
Classes may optionally use the Sugar "Connectors" to allow for site-wide configuration of the class, things such as API keys and system wide URL’s may be entered there. Creating a sub-connector and linking it to the class is beyond the scope of this document, for a reference implementation you will want to check the Facebook external API.