Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

The following API’s are available for integration with end user scripts or automation tools. All API’s listed below require valid Opsera Access Tokens. Please note, GET requests for tools or pipelines are limited to a max of 1000 records.

Access Tokens and Scope:

Opsera Access Tokens have predefined scopes. These scopes limit where the the token can be used for more enhanced security. So the scope selected when the token is created must match the required scopes below for the API’s in order for access to be granted. If a 403: Forbidden message is returned, it either means that the token is using the wrong scope or the user who generated the token doesn’t have the permissions necessary to perform the given action on the object. The owner/creator of the token is used in determining access permissions in concert with the scope. For more information on scopes and access tokens, please review the Opsera Access Tokens documentation.

Please Note: In addition to a valid token with the proper scope being used, the user who generated/owns the token MUST have the permissions to the object in order for the API to work. A user who does not have access to a given pipeline (even if their token is valid) will not be allowed to perform actions on that pipeline. A user must still be granted that access in the Opsera UI first.

API Server:

When accessing the Opsera API, this is the URL to use:

https://app.opsera.io

URL

METHOD

DESCRIPTION

Scope

DATA

RESPONSE

/api/v1/pipeline/run

POST

Triggers a run operation on the pipeline which returns the status, a message and the run count for the new run.

API Access

Pipeline Access

{
    "pipelineId":"5fd56d90979ee048ee660624"
}
{
    "status": "executed",
    "message": "Run pipeline request submitted successfully for (5fd56d90979ee048ee660624)",
    "runCount": 2
}

OR

{
    "status": "failed",
    "message": "Pipeline 5fd56d90979ee048ee660624 is currently in a paused state.  Will not start another job until this pending status is resolved."
}

/api/v1/pipeline/status

POST

Gets the status of a pipeline based on the run count. So this can work against the current run or prior runs from a historical perspective.

API Access

Pipeline Access

Pipeline Logs (Read Only)

{
    "pipelineId":"5fd56d90979ee048ee660624",
    "runCount": 3
}

{
    "status": "success",
    "message": "Pipeline: Blank Template's Run 3 was successful."
}

/api/v1/pipeline/reset

POST

Resets the pipeline to the beginning, clearing out any current run data.

API Access

Pipeline Access

{
    "pipelineId":"5fd56d90979ee048ee660624"
}

    "status": "success",
    "message": "The pipeline run status has been reset."
}

/api/v1/pipeline/stop

POST

Stops a running pipeline. This action will post a stop operation to kafka for supported tools, but the pipeline job will finish it’s current operaiton and then shut down. This is not a hard stop operation.

API Access

Pipeline Access

{
    "pipelineId":"5fd56d90979ee048ee660624"
}

{
    "status": "success",
    "message": "The pipeline has been stopped."
}

/api/v1/pipeline/summary

POST

Gets the pipeline data by ID

API Access

Pipeline Access

{
    "pipelineId":"5fd56d90979ee048ee660624"
}

Returns full JSON data object of pipeline.

/api/v1/pipeline/logs

POST

Gets pipeline activity logs. Optional runCount can be passed as integer. Data is limited to a max of 1000 records and is always sorted by most recent activity first.

The “type” property of the POST body is optional. If that exact string “console output” is passed, it will restrict the logs being returned to the console log activity for that given run.

API Access

Pipeline Access

Pipeline Logs (Read Only)

{
    "pipelineId":"5fd56d90979ee048ee660624",
    "runCount": 2,
    "type":"console output" //optional value
}

Array of pipeline activity logs.

/api/v1/registry/tools

GET

Gets the list of all tools (with all JSON data) that they have access to.

API Access

Tool Registry Access

n/a

Returns an array of tool objects in JSON format

/api/v1/registry/summary

POST

Gets a tool registry JSON object with ALL data about that tool by ID.

API Access

Tool Registry Access

{
    "toolId":"5fc7a12ebed9dd3a622f5d22"
}

Returns the full tool object in JSON format.

/api/v1/registry/update

POST

Passes a tool registry ID and then the data object properties of that tool in JSON that you wish to update. This can be as much or as little of the root JSON object as long as the data structure is preserved. It’s advised not to send the “_id” but it isn’t going to break things. Same with the createdAt or updatedAt. This allows for strategic updates of just the root properties of the pipeline data object or the whole thing.

API Access

Tool Registry Access

{
    "toolId":"5fd56d90979ee048ee660624",
    "tool": {
        "name":"Updated Tool Name Via CLI",
        "description": "Updating the description here through customer API.  Fingers crossed"
    }
}

Returns the updated tool object in JSON format

/api/v1/pipeline/pipelines

GET

Gets the list of all pipelines (with all JSON data) the user token has access to

API Access

Pipeline Access

n/a

Returns an array of pipeline objects in JSON format

/api/v1/logs/user/actions

GET

Gets the User Activity Logs for the system. This is a route limited to Site Admins and Power users and requires a token of either API scope or Security Logs scope.

If no date parameter is passed, the last 7 days of logs will be returned (up to a max of 1000 records)

API Access

Security Logs (Read Only)

Optional Query Parameters:

?date=YYYY-MM-DD

?type=<value from type field>

{
    "count": 6,
    "data": [
        {
            "_id": "61042540e1d666c9ded178c4",
            "user_id": "5e1cbf251c26d68f7ce6361e",
            "user_email": "support@opsera.io",
            "type": "pipeline",
            "action": "update",
            "target_id": "5fbe589a0fae8b021e137534",
            "account": "org-opsera-dnd-acc0",
            "createdAt": "2021-07-30T16:13:52.109Z",
            "updatedAt": "2021-07-30T16:13:52.109Z",
            "__v": 0
        },
  ]
}

/api/v1/logs/user/tokens

GET

Gets the Personal Access Tokens' Activity Logs. This is a route limited to Site Admins and Power users and requires a token of either API scope or Security Logs scope.

If no date parameter is passed, the last 7 days will be returned.(up to a max of 1000 records)

API Access

Security Logs (Read Only)

Optional Query Parameters:

?date=YYYY-MM-DD

?scope=<value from scope field>

{
    "count": 6,
    "data": [
        {
            "_id": "61057f3a1429a35336563240",
            "token_id": "61043b2bbcb6d95b55adc5fd",
            "scope": "api",
            "target": "/v1/logs/user/tokens",
            "user_id": "5e1cbf251c26d68f7ce6361e",
            "account": "org-opsera-dnd-acc0",
            "createdAt": "2021-07-31T16:50:02.242Z",
            "updatedAt": "2021-07-31T16:50:02.242Z",
            "__v": 0
        },
  ]
}

  • No labels