Cloud Pak for Data

 View Only

 CP4D List Jobs API to Get 200 + Results

Jet Zhang's profile image
Jet Zhang posted Mon June 16, 2025 04:15 PM

Hi, our organization is using CP4D with MDM and DG services. I am trying to build some automation workflows for daily jobs. While in some of our projects there are more than 1000 jobs. I will need to get all job's id in the project whit Python and API call. While the API of "Get list of jobs under a project or a space" can only GET maximum 200 results with a "next" JSON object and "bookmark" value. I tried all methods to combine the response "bookmark" with API to GET next batch of data but all of them not working. Is there somebody here know how to work with this strange API?

Response is like:

{
    "next": {
        "query": "*:*",
        "limit": -1,
        "bookmark": "g1AAAAGceJzLYWBgYMlgTmFwSM4vTc5ISXIoTynQhbJ1jfSQeHrJBSm6mXnFJYl5yal6xWXJesk5pcUlqUV6OfnJiTk5QJOYEhmS7P___5-VweTmwDs1WgEolsTAwJdCPRuSHEBm1sMs4T45fwFQIFGJejbksQBJhgYgBbRkP8QrS7sYIF4R8aS2RQcgFkG8w9M6MwFq0dYsAOPYiOk",
        "include": "entity"
    },
    "total_rows": 772,
    "results": [
        {
....
}]
}
The API:
GET /v2/jobs?project_id=xxxxx
Ralf Martin's profile image
Ralf Martin IBM Champion

I am not sure if I understand what you are doing, but why don't you use CPDCTL to get the information you want from CP4D?

Jet Zhang's profile image
Jet Zhang

Hi team,

The reason I don't use CPDCTL is too many jobs. We have to make a bash shell script to do the job.

Finally we found the solution to add the page information to next request. That is put whole content of "next in response including { and } as text and change it to URL format. Then add it to request body as "next" and then it will request for next page.