ha_responsefields & ha_returnfields

Below an example of the responsefields used with the API method users.getLoggedin.

ha_responsefield
The parameter ha_responsefield is used to get more information with the API methods. In this example you also get the information about profilepicture. which is not standardly given.

ha_returnfields
With the ha_returnfields you can get only the information you want to get with the Data API. For example only the firstname of a Hyver instead of the whole Profile. With this technique you can make applications more efficiƫnt.

Example

// Use the psrameter ha_responsefield to get the profilepicture and the amount of scraps - Optional parameter
$responsefields =  "profilepicture,scrapscount";
 
// The parameter ha_returnfields is used to get only the information you need. In this case only the title, the picture and amount of scraps  - Optional parameter
$returnfields =  "/user/profilepicture/title, /user/profilepicture/icon_medium/src,/user,/user/scrapscount";
 
// Execute the API call with all the required parameters
$oGenusApis->doMethod("users.getLoggedin", array(
       "ha_responsefields"=>$responsefields,
       "ha_returnfields"=>$returnfields 
),$oAccessToken);
 

This example uses the OAuth authorization example and the GenusApis PHP library.

Click here to see a live example and download the source code.