Skip to main content
Answer

http request body filtering

  • July 4, 2025
  • 9 replies
  • 80 views

Chris Selph
Practitioner
Forum|alt.badge.img

I’m using n8n AI agent builder to query CDF via an http request. The body of the request is:

The request URL is https://westeurope-1.cognitedata.com/api/v1/projects/essc-sandbox-44/events

{
"filter": {
"startTime": {
"min": 1751070336000,
"max": 1751588736000
},
"dataSetIds": [7726848970162689]
},
"limit": 1000
}

CDF seems to recognize the datasetid filter but not other filters like starttime as shown or others like Types.

 

The result set returned is all events in that datasetid.

I’ve also tried minstarttime and maxstarttime.

ideas?

 

 

Best answer by Mithila Jayalath

@Chris Selph the request URL that you should use in this case is,

https://westeurope-1.cognitedata.com/api/v1/projects/essc-sandbox-44/events/list

You can find more infomation in the API documentation here.

The request body should look like this,

{
"filter": {
"startTime": {
"min": 1751070336000,
"max": 1751588736000
},
"dataSetIds": [
{
"id": "7726848970162689"
}
]
},
"limit": 1000
}

Please let me know whether this work as expected.

9 replies

Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8
  • Seasoned Practitioner
  • Answer
  • July 7, 2025

@Chris Selph the request URL that you should use in this case is,

https://westeurope-1.cognitedata.com/api/v1/projects/essc-sandbox-44/events/list

You can find more infomation in the API documentation here.

The request body should look like this,

{
"filter": {
"startTime": {
"min": 1751070336000,
"max": 1751588736000
},
"dataSetIds": [
{
"id": "7726848970162689"
}
]
},
"limit": 1000
}

Please let me know whether this work as expected.


Chris Selph
Practitioner
Forum|alt.badge.img
  • Author
  • Practitioner
  • July 8, 2025

@Mithila Jayalath  thanks for your response. My trial of the new body you sent shows the returned data outside of the min and max time stamps which are june 28 to july 4 2025. Here is example returned record from 2009 which is at least from the correct dataset. Any ideas are welcome, there must be something missing.

 

Note i get the same response using postman.

 

{

"dataSetId": 7726848970162689,

"startTime": 1231041134000,

"endTime": 1231045051000,

"type": "Strand Event",

"subtype": "Heat",

"description": "Strand Heat Event 2009-01-04 03:52:14 Shift 7-3",

"metadata": {

"iShroud_mi": "0",

"fAverage_Speed": "16.09",

"fChromium": "0.10776",

"fIron": "0.0",

"iPLC_Heat_Number": "142532",

"fCalcium": "0.0",

"fNickel": "0.138",

"cMold_No": "7.000000",


Chris Selph
Practitioner
Forum|alt.badge.img
  • Author
  • Practitioner
  • July 8, 2025

sorry i submitted too soon, let me work this out…

 


Chris Selph
Practitioner
Forum|alt.badge.img
  • Author
  • Practitioner
  • July 8, 2025

ok, using your url and body from above, neither n8n nor postman like it. Postman says: 

{
    "error": {
        "code": 400,
        "message": "Could not parse parameters (id). Please check the API documentation: https://doc.cognitedata.com/."
    }
}

 

as if it is expecting query params to be sent?


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

@Chris Selph it looks like something is wrong in your setup. It is working as expected when I check from my end.


Chris Selph
Practitioner
Forum|alt.badge.img
  • Author
  • Practitioner
  • July 9, 2025

Thanks, will keep digging. 


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

If you need further help, I can hop into a meeting and check on this.


Chris Selph
Practitioner
Forum|alt.badge.img
  • Author
  • Practitioner
  • July 9, 2025

@Mithila Jayalath I really appreciate the offer to help. 

thanks for your correct suggestion. In my trial I was using a GET, not the required POST method. It is functioning well now!

Chris

 


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

Great! I’m happy to hear it works.