GSD-RestApi Serialization event macro


This is a complete list of parameters that event macro must have in order to be properly executed when serialization of type "macro" takes place.

Parameter Type Description
&res: HJSON IN-OUT JSON Handle with returned error message, if any error occurs
obj: DBOBJECT IN Object that will be serialized
&objectJson: HJSON IN-OUT JSON Handle
&serialization: HJSON IN JSON Handle with Serialization
&ok: BOOL OUT False when something went wrong, error info will be added to 'res HJSON'

Example declaration:

1
2
INT ExampleSerializationEvent( HJSON &res, DBOBJECT obj, HJSON &objectJson, HJSON &serialization, BOOL &ok )
RETURN( 1 )

Example usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
INT ExampleSerializationEvent( HJSON &res, DBOBJECT obj, HJSON &objectJson, HJSON &serialization, BOOL &ok )
    objectJson.GetMember( "Name", TRUE ).SetString( obj.GetString( "Name" ) );
    objectJson.GetMember( "Name1", TRUE ).SetString( obj.GetString( "Name1" ) );
    objectJson.GetMember( "Name2", TRUE ).SetString( obj.GetString( "Name2" ) );
    objectJson.GetMember( "Name3", TRUE ).SetString( obj.GetString( "Name3" ) );
    objectJson.GetMember( "Beschreibung", TRUE ).SetString( obj.GetString( "Beschreibung" ) );
    objectJson.GetMember( "Bezeichnung", TRUE ).SetString( obj.GetString( "Bezeichnung" ) );
    objectJson.GetMember( "Nummer", TRUE ).SetString( obj.GetString( "Nummer" ) );
    objectJson.GetMember( "Erstellungszeit", TRUE ).SetString( obj.GetTime( "Erstellungszeit" ).xRestApi_ConvertTimeToISOTime() );
    res.xRestApi_Success_OK( objectJson );
RETURN( 1 )