Notebooks

Create Notebook

POST /_notebooks/notebooks/

Description This is used for creating a new notebook.

HTTP Method POST

Endpoint: /_notebooks/notebooks/

Request Header Authorization Basic <token>

Sample Request

curl -X POST https://app.4pointx.com/_notebooks/notebooks/ \
--header 'Authorization: Basic <token>' \

Sample Response

Success

{
    "username": "admin",
    "notebook_name": "2023-12-13_07:13:50_admin.ipynb",
    "path": "/notebooks/admin/2023-12-13_07:13:50_admin.ipynb"
}

Error

{
    "error": {
        "status": 400,
        "message": "Error occurred while creating the notebook file: {str(e)}"
    }
}
{
    "error": {
        "status": 400,
        "message": "Error occurred while setting ownership of the notebook file: {str(e)}"
    }
}

Delete Notebook

DELETE /_notebooks/notebooks/

Description This is used for deleting a new notebook.

HTTP Method DELETE

Endpoint: /_notebooks/notebooks/

Request Header Authorization Basic <token>

Request Parameters

Body Parameters

  • nbk_ids (list, required): The Notebook ID to be deleted.

Sample Request

curl -X DELETE 'https://app.4pointx.com/_notebooks/notebooks/' \
--header 'Authorization: Basic <token>' \
--header 'Content-Type: application/json' \
--data '{"nbk_ids":["cc3544d1-c503-430a-827a-b5ef4f378b46"]}'

Sample Response

Success

{
    "Success"
}

Error

{
    "error": {
        "status": 400,
        "message": "Notebook IDs are required"
    }
}
{
    "error": {
        "status": 200,
        "message": "No notebooks deleted"
    }
}
{
    "error": {
        "status": 400,
        "message": "Error occurred while deleting the notebook file: {str(e)}"
    }
}
{
    "error": {
        "status": 400,
        "message": "Error occurred during notebook deletion: {str(e)}"
    }
}

Rename Notebook

PUT /_notebooks/notebooks/<notebook_id>

Description Rename an existing notebook.

HTTP Method PUT

Endpoint /_notebooks/notebooks/<notebook_id>

Request Header Authorization Basic <token>

Request Parameters

URL Parameters

  • notebook_id (str, required): The ID of the Notebook.

Sample Request

curl -X PUT 'https://app.4pointx.com/_notebooks/notebooks/' \
--header 'Authorization: Basic <token>' \

Sample Response

Success

{
    "Rename Successful"
}

Error

{
    "error": {
        "status": 400,
        "message": "No Notebook found"
    }
}
{
    "error": {
        "status": 400,
        "message": "Missing new name"
    }
}
{
    "error": {
        "status": 400,
        "message": "Notebook ID is missing"
    }
}
{
    "error": {
        "status": 404,
        "message": "Error occurred while renaming the notebook file: {str(e)}"
    }
}

Fetch Notebook Details

GET /_notebooks/notebooks/<notebook_id>

Description Fetch details of a notebook.

HTTP Method GET

ENDPOINT /_notebooks/notebooks/<notebook_id>

Request Header Authorization Basic <token>

URL Parameters

  • notebook_id (str, required): The ID of the Notebook.

Sample Request

curl -X GET 'https://app.4pointx.com/_notebooks/notebooks/603d4b06-be33-41bd-b610-34b41df9653a' \
--header 'Authorization: Basic <token>' \

Sample Response

Success

{
    "schedule": {
        "period": null,
        "until": null,
        "time": null
    },
    "notebook_name": "test-11.ipynb",
    "updated_at": 1688986154000,
    "updated_by": "admin",
    "created_at": 1688986154000,
    "last_run": null,
    "attributes": {
        "path": "/notebooks/admin/"
    },
    "created_by": "admin",
    "no_of_runs": 0,
    "notebook_id": "603d4b06-be33-41bd-b610-34b41df9653a",
    "status": "Not Scheduled"
}

Error

{
     "error": {
         "status": 400,
         "message": "Notebook ID invalid."
     }
 }
{
     "error": {
         "status": 400,
         "message": "Error occurred during notebook retrieval: {str(e)}"
     }
 }

Fetch List of Notebooks

GET /_notebooks/notebooks/_all

Description Fetch list of notebooks.

HTTP Method GET

ENDPOINT /_notebooks/notebooks/_all

Request Header Authorization Basic <token>

Sample Request

curl -X GET 'https://app.4pointx.com/_notebooks/notebooks/_all' \
--header 'Authorization: Basic <token>' \

Sample Response

Success

[
    {
        "notebook_id": "18b59e02-da56-453d-bc43-c5628f59d88b",
        "status": "Not Scheduled",
        "notebook_name": "2023-10-13_05:52:12_admin.ipynb",
        "created_at": 1697176332000,
        "updated_at": 1697176332000,
        "created_by": "admin",
        "updated_by": "admin",
        "last_run": "-",
        "no_of_runs": 0,
        "schedule": {
            "period": null,
            "until": null,
            "time": null
        },
        "attributes": {
            "path": "/notebooks/admin/"
        }
    },
    {
        "notebook_id": "145542c5-b9c3-4cc0-bbad-21bc68d1c705",
        "status": "Not Scheduled",
        "notebook_name": "2023-10-13_10:20:24_admin.ipynb",
        "created_at": 1697192424000,
        "updated_at": 1697192424000,
        "created_by": "admin",
        "updated_by": "admin",
        "last_run": "-",
        "no_of_runs": 0,
        "schedule": {
            "period": null,
            "until": null,
            "time": null
        },
        "attributes": {
            "path": "/notebooks/admin/"
        }
    },
    {
        "notebook_id": "87ee1c14-0208-4dc0-96b5-b6d151057c67",
        "status": "Not Scheduled",
        "notebook_name": "2023-10-31_08:49:46_admin.ipynb",
        "created_at": 1698742186000,
        "updated_at": 1698742186000,
        "created_by": "admin",
        "updated_by": "admin",
        "last_run": "-",
        "no_of_runs": 0,
        "schedule": {
            "period": null,
            "until": null,
            "time": null
        },
        "attributes": {
            "path": "/notebooks/admin/"
        }
    },
    {
        "notebook_id": "6f1098b5-13c0-4edf-9bd1-4bcf07d147cb",
        "status": "Not Scheduled",
        "notebook_name": "2023-11-03_07:12:14_admin.ipynb",
        "created_at": 1698995535000,
        "updated_at": 1698995535000,
        "created_by": "admin",
        "updated_by": "admin",
        "last_run": "-",
        "no_of_runs": 0,
        "schedule": {
            "period": null,
            "until": null,
            "time": null
        },
        "attributes": {
            "path": "/notebooks/admin/"
        }
    }
]

Error

{
     "error": {
         "status": 400,
         "message": "Error occurred while retrieving notebook information: {str(e)}"
     }
 }

Fetch Count of Notebooks

GET /_notebooks/notebooks/_count

Description Retrieve summary of count of notebooks.

HTTP Method GET

ENDPOINT /_notebooks/notebooks/_count

Request Header Authorization Basic <token>

Sample Request

curl -X GET 'https://app.4pointx.com/_notebooks/notebooks/_count' \
--header 'Authorization: Basic <token>' \

Sample Response

Success

{
    "Total Notebooks": 2,
    "Not Scheduled": 2,
    "Scheduled": 0
}

Error

{
     "error": {
         "status": 400,
         "message": "Error occurred while retrieving notebook metrics: {str(e)}"
     }
 }

Run Notebook

GET /_notebooks/notebooks/_run

Description Retrieve summary of count of notebooks.

HTTP Method GET

ENDPOINT /_notebooks/notebooks/_run

Request Header Authorization Basic <token>

Request Parameters

Body Parameters

  • nbkIds (list, required): The ID of the Notebook.

  • module (str, required): The module name.

Sample Request

curl -X GET 'https://app.4pointx.com//_notebooks/notebooks/_run' \
--header 'Authorization: Basic <token>' \
--header 'Content-Type: application/json' \
--data '{nbkIds: ["8da5dd53-8ce0-4817-b6a1-e088f1aac8a7"], module: "notebooks"}'

Sample Response

Success

{

}

Error

{
     "error": {
         "status": 400,
         "message": "Notebook ID(s) are required"
     }
 }
{
     "error": {
         "status": 400,
         "message": "Error occurred during notebook execution: {str(e)}"
     }
 }
{
     "error": {
         "status": 500,
         "message": "Error occurred during request processing: {str(e)}"
     }
 }

Schedule Notebook

POST /_notebooks/notebooks/_schedule

Description Schedule notebooks.

HTTP Method POST

ENDPOINT /_notebooks/notebooks/_schedule

Request Header Authorization Basic <token>

Request Parameters

Body Parameters

  • nbk_ids (list, required): Notebook ID to be scheduled.

  • until (string, required): The end date and time for scheduling a notebook in “YYYY-MM-DD HH:MM” format.

  • period (string, optional): The day of the week for scheduling a notebook(e.g., “Monday”).

  • time (string, optional): The time of day for scheduling a notebook in “HH:MM” format.

Sample Request

curl -X GET 'https://app.4pointx.com/_notebooks/notebooks/_schedule' \
--header 'Authorization: Basic <token>' \
--header 'Content-Type: application/json' \
--data '
     {"nbk_ids":["cc3544d1-c503-430a-827a-b5ef4f378b46"],
      "period":"Monday",
      "time":"06:50",
      "until":"2024-12-13 06:50"
      }'

Sample Response

Success

{
    "Success"
}

Error

{
    "error": {
        "status": 400,
        "message": "Error occurred during request processing: {str(e)}"
    }
}

Unschedule Notebook

POST /_notebooks/notebooks/_unschedule

Description Unschedule notebooks.

HTTP Method POST

ENDPOINT /_notebooks/notebooks/_unschedule

Request Header Authorization Basic <token>

Request Parameters

Body Parameters

  • nbk_ids (list, required): Notebook ID to be unscheduled.

Sample Request

curl -X GET 'https://app.4pointx.com/_notebooks/notebooks/_unschedule' \
--header 'Authorization: Basic <token>' \
--header 'Content-Type: application/json' \
--data '{"nbk_ids":["cc3544d1-c503-430a-827a-b5ef4f378b46"]}'

Sample Response

Success

{
    "Success"
}

Error

{
     "error": {
         "status": 500,
         "message": "Error occurred during request processing: {str(e)}"
     }
 }