IafObjectModelAPISvc
addApiConfig
Add an API config definition
| Parameter | Required | Type | Description |
|---|---|---|---|
| configId | Yes | String | The API config id |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
Promise<Object> - Success or failure message
const response = await IafObjectModelAPISvc.addApiConfig(config._id, ctx);
deleteApiConfig
Deletes am API config definition
| Parameter | Required | Type | Description |
|---|---|---|---|
| namespace | Yes | String | Namespace as string |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
Promise<Object> - Success or failure message
const response = await IafObjectModelAPISvc.deleteApiConfig(namespace, ctx);
deletePermission
Deletes a permission when you pass its id
| Parameter | Required | Type | Description |
|---|---|---|---|
| id | Yes | String | Permission id |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
Promise<String> - ok:204 response
const response = await IafObjectModelAPISvc.deletePermission(perm._id, ctx);
getApiConfig
Get an API config definition
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | Yes | Object | A criteria object with _isconfigadded or _tobedeleted flag |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
Promise<Object> - Api config definition
getPermissions
Gets permissions for an API config definition
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | Yes | PermissionCriteria | Criteria to fetch permissions |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
Promise<Page<Permission>> - A promise with a page of Permission objects
const criteria = {
_namespace: project._namespaces[0]
};
const permissions = await IafObjectModelAPISvc.getPermissions(criteria, ctx);
getRequestById
Retrieve the OMAPI request for the specified request ID
| Parameter | Required | Type | Description |
|---|---|---|---|
| reqId | Yes | String | OMAPI request id |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
getRequestLogById
Retrieve the OMAPI request log for the specified request ID
| Parameter | Required | Type | Description |
|---|---|---|---|
| reqId | Yes | String | OMAPI request id |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
getRequests
Retrieve the OMAPI requests for the criteria
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | Yes | Object | A criteria object like this {query: {key: value}}, key can be any one of below |
| _requestid, _status, _jobid, _namespace, _apiconfigid, _scriptid | |||
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
getScriptExecutionLogsByJobId
Get the logs of a specific script execution by job id
| Parameter | Required | Type | Description |
|---|---|---|---|
| jobId | Yes | String | id of the job |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
| options | Yes | Object | {headers: {X-ObjectModelSvc-Client-Id: value1, X-ObjectModelSvc-Noauth-Secret: value2}} |
Promise<Object> - the logs of a particular job
getScriptExecutionResults
Get the result of script execution
| Parameter | Required | Type | Description |
|---|---|---|---|
| criteria | Yes | Object | A criteria object like this {query: {key: value}}, key can be any one of below |
| scriptInfo, _status,_jobid, _namespace, _headers._createdby,_headers._source | |||
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
| options | Yes | Object | {headers: {X-ObjectModelSvc-Client-Id: value1, X-ObjectModelSvc-Noauth-Secret: value2}} |
updatePermissions
Updates permissions for an Object Model Service resource, such as an API config definition, or creates a permission doesn't exist. The _resourceDesc, _namespace, _user properties are used to identify if a permission exists or not.
| Parameter | Required | Type | Description |
|---|---|---|---|
| permissions | Yes | Array<Permission> | Array of Permission objects |
| ctx | Yes | Ctx | Context, such as namespaces and authentication token information |
Promise<CreatePermissionsResponse> - A promise with success and failure permissions
permissions.forEach( perm =>
perm._namespace = project._namespaces[0];
);
const response = await IafObjectModelAPISvc.updatePermissions(permissions, ctx);