string
| String
Builds URL based on module name action and attributes of the format rooturl/module/id/action.
The attributes
hash must contain id
of the resource being
actioned upon for record CRUD and relatedId
if the URL is build for
relationship CRUD.
Kind: global function
Returns: string
- URL for specified resource.String
- Locale
Since: v0.0.1
Param | Type | Description |
---|---|---|
options | Object |
|
options.moduleName | string |
module name. |
options.action | string |
CRUD method. |
options.resourceAttributes | Object |
object of resource being actioned upon, e.g. {name: "test", id: "testId"} . |
options.URLParams | Object |
URL parameters. |
Example
// undefined
buildURL({
moduleName: 'Accounts',
action: 'create',
resourceAttributes: { name: 'testAccount', id: 'testId' },
URLParams: { erased_fields: true }
}) // -> ''
// defined
buildURL({
moduleName: 'Accounts',
action: 'create',
resourceAttributes: { name: 'testAccount', id: 'testId' },
URLParams: { erased_fields: true }
}) // -> 'rest/v11_7/Accounts?erased_fields=true'