Solved

Issue in calling FDM Post APIs

  • 21 February 2023
  • 7 replies
  • 123 views

Badge

I am trying new FDM APIs. In POST endpoints I am facing issue “Missing body for POST request”

Am I missing some parameters? I am using POST body as per documentation

 

icon

Best answer by Snehal Jagtap 21 February 2023, 19:47

View original

7 replies

Userlevel 3

Hi @Snehal Jagtap, and thanks for reaching out.

 

It would be very helpful if you included the request payload you’re trying to use, resulting in the problem you’re experiencing?

Badge

This is the payload I am trying to use in POST Space API

https://westeurope-1.cognitedata.com/api/v1/projects/slb-pdf/models/spaces

{

"items": [

{

"space": "snehal-test-space",

"description": "snehal-test-space",

"name": "snehal-test-space"

}

]

}

 

Headers : 

--header 'content-type: application/json' \

--header 'cdf-version: alpha' \

--header 'Authorization: Bearer <token>’

Badge +4

Hi @Snehal Jagtap 

I'm quite new around here so I could be 3 steps behind you.  But is that the correct url for applying spaces?  Should "models" be replaced with "datamodelstorage" as below?

api/v1/projects/{project}/datamodelstorage/spaces 

 

Docs

Badge

I tried with this as well, still I am getting same issue. Am I missing something in request?

Badge +4

It looks like the external id field is required in the request.

 

Userlevel 3
Badge

@Snehal Jagtap the error “missing POST body” suggests the request is malformed. Have you tried different tools (Postman, curl, VSCode REST client, etc.)?

Badge

@Juan Alvarado yeah it was postman setting issue, not sure in headers postman is giving as data-raw and by changing it to data it worked. Thanks!

Reply