Skip to main content
Seasoned ⭐️
February 21, 2023
Solved

Issue in calling FDM Post APIs

  • February 21, 2023
  • 7 replies
  • 175 views

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

 

    Best answer by Snehal Jagtap

    @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!

    7 replies

    Lead Product Manager
    February 21, 2023

    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?

    Seasoned ⭐️
    February 21, 2023

    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>’

    Practitioner ⭐️⭐️⭐️
    February 21, 2023

    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

    Seasoned ⭐️
    February 21, 2023

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

    Practitioner ⭐️⭐️⭐️
    February 21, 2023

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

     

    Juan Alvarado
    Seasoned ⭐️⭐️⭐️
    Seasoned ⭐️⭐️⭐️
    February 21, 2023

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

    Snehal JagtapAuthorAnswer
    Seasoned ⭐️
    February 21, 2023

    @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!