Development > API > Topic

API - Specs/#4194

Feb 24, 2007 / pixtur
Aug 26, 2009 / mapuche
 

Attached files

No files uploaded
 

Case studiesπ

  • Writing widgets for booking of effots
  • Exporting
    • Export some data in XLS/XML/...
    • synchronize database with other programs (e.g. Exchange, local Outlook,...)
  • cronjobs like repeating / regular tasks
  • streber could do some repository-jobs (SVN integration,...); we could write some lines of code to integrate an existing SVN-repository within streber (read-only). So all repository-jobs could be done with a tool, which was written for such things. (I have some headaches with inflating streber to a full-features SVN-Tool *G*)
  • TimeTracker
  • outlook sync
  • exchange sync

General Purposeπ

  • retrieving information from streber without a browser-frontend
  • changing information stored in streber database
  • exchange information with streber with third-party software (e.g. EMail-client, external database, ...)


Requirementsπ

  • Authentication
  • Data query & export
  • Data import
  • Syncing with other programms
  • Easy to use with others languages like:
    • Python, .NET


Transfering informationπ


Defining proceduresπ

I would use the established naming of functions in streber with prefix "get" to read specific information:
  • getProjList => all Infos, that projList offers for that authenticated user
  • getProjViewTasks => all Infos on a project-ID for that authenticated user
  • ...
On the other side I would use prefix "put" for storing/changing information in streber:
  • putEffortNew => book new effort (requires all information like "start", "end", ...)
  • putPersonNew => add new person
  • ...



9 Comments

guest:set is a more common prefix for functions that update/inserts information.

7 years ago -


pixtur:Antwort auf set is a more common prefix for functions that update/inserts information.

7 years ago (2. update 7 years ago)

Wouldn't the suffix like "new" / "edit" be sufficient? But otherwise, streber's API should not be too far away from other solutions.



idolpx:Reply to Antwort auf set is a more common prefix for functions that update/inserts information.

7 years ago

Maybe "add" for new items?

idolpx:Reply to set is a more common prefix for functions that update/inserts information.

7 years ago

I agree...

oyvind.kinsey:

7 years ago

The ideal way to design such function is to use only one function for all createing/updating, and this would normally be called set_ObjectName.
The thing separating a create from an insert would be the presence of an identificator.

So for instance, if I give the function set_object an object without an identificator it would create the element and return the new Id, if I give it an object with an identificator it would simply update it. In some projects I have this is actually implemented in the stored procedure stored in the database. So all functions in my normal code uses the set_object knowing that as long as the returned value is not 0, the object is created/updated.

In this way, the developer seldoms needs to think about this being an update or an insert, just call set_object and you will get back the new/current id.

On the naming convention, set_ and get_ is extremely common in most frameworks.

oyvind.kinsey:

7 years ago

set/get also helps when creating dynamic function calls. Just prepend get_ to the objects class name to retrieve and set_ to save.

xl:considered REST?

7 years ago

i dont want to make it more complex than needed.
but i heard REST (en de) is used for this quite often.

idolpx:Reply to considered REST?

7 years ago

REST sounds good to me. :)

mapuche:With Zend you aren't restricted on the Service

5 years ago

Maybe we can use the Zend Framework. There you just have to write a PHP-class with Functions like getTask(projectId) and then you can register this class to one of Zends ServiceServers (Rest,AMF,JSON,XML-RPC) and you got the service-definition, transport-stuff, XML-Headers,... at no cost and managed by Zend. Even AMF for Flex, Air...

An example for the REST Server:
http://blog.astrumfutura.com/archives/245-RESTful-Web-Services-with-Zend-Framework.html

So to get streber, into the next level we f*#$in need this API.