Using advanced client services.
To learn more about API integrations go to Using APIs in an App page. The rest of this section will cover using and editing an imported service in an app.
NoteIn older libraries version (1.0, 1.1) EntityAPI is used to create whole request object with default values so all parameters are sent in request (even those you don't want to send).
In new libraries version (1.2 and higher) only filled request fields are sent to server so to send empty values to server you should add mapping/JS code with desirable value or add JS code to create whole request object with EntityAPI.
To create, edit, or delete request parameters, open Request view, and switch to the Query String tab.
To add a response parameter, enter the output parameter’s name, and click Add.
You can create complex response structures to fit your needs.
Substituting Values in a URL.You can use the Settings service to substitute values in the URL, headers, query values, and body values.
- Any part of the URL can be expanded this way, even the entire URL.
- Header parameters are not used for service request URL.
Be sure to turn off the Echo service when using the app in production.
- Change the REST service URL to http://mywebsite.com/name/
{id}
/edit. - Because the value of the id parameter will be automatically inserted to the
{id}
placeholder, it won’t be added to the end of the URL as a query string.
Character | Escape Character | Character | Escape Character |
---|---|---|---|
Space | %20 | %23 | |
$ | %24 | % | %25 |
& | %26 | @ | %40 |
` | %60 | / | %2F |
: | %3A | ; | %3B |
< | %3C | = | %3D |
> | %3E | ? | %3F |
[ | %5B | \ | %5C |
] | %5D | ^ | %5E |
| %7B | | | %7C |
| %7D | ~ | %7E |
“ | %22 | ‘ | %27 |
%2B | , | %2C |
http://mywebsite.com/name/{SettingsName.parameterName}
/edit
Apperyio.Config.get( expression [, default_value] )
To retrieve data from settings:
- expression – setting name or expression like SettingsName.database_url.
- default_value – (optional) if settings name or expression can’t be found, then default_value will be returned.
Returns the value of setting or default_value (if specified).
Example:
Apperyio.Config.get('MySettings.database_url');
Example:
console.log( Apperyio.Config.get('MySettings.undefined_property', 'default value') );
> default value
NoteIt can be added for current runtime only, and doesn’t store anything to the app/constants.js file.
Example:
Apperyio.Config.add('MySettings.database_url', 'https://api.appery.io/rest/1/db');
- Settings – replace or initialize Config service in the app.
In general this function shouldn’t be called since it runs at the start of application bootstrapping with all of the settings.
Example:
Apperyio.Config.init( {
MySettings: {
database_url: 'https://api.appery.io/rest/1/db'
}
} );
NoteIt removes the setting for current runtime only, not from the app/constants.js file.
Example:
console.log( Apperyio.Config.get('MySettings.database_url') );
> https://api.appery.io/rest/1/db
Apperyio.Config.remove('MySettings.database_url');
console.log( Apperyio.Config.get('MySettings.database_url') );
> undefined
var $routeParams = Apperyio.get( "$routeParams" );
$scope.$routeParams = $routeParams;