"error": "Body parameter 'names' is missing" with validation api

Hi,

Need assistance with content server api. I get below error when accessing validation api http://extsreamcs1624.lab.opentext.com:8080/OTCS/cs/api/v1/validation/nodes

"error": "Body parameter 'names' is missing"

I added the required data in the body.

{ "parent_id":2000,
"names":["myDocument.doc","myEmail.msg","folder1"]
}

I also tried with the below input in the body. I still get the same error

{\"parent_id\":2000,\"names\":[\"myDocument.doc\",\"myEmail.msg\",\"folder1\"]}

Tagged:

Comments

  • Based on the syntax as specified in the IMPLEMENTATION NOTE of the API Documentation, it seems they are expecting a "body" property in the request body

    Hence, we will need to find a way to put a "body" property in the request body.

    Here is what I did:

    async function testValidation() {

    let body =  {"parent_id": 2000,"names":["myDocument.doc","myEmail.msg","folder1"]};

    let reqBody = new FormData();

    reqBody.append("body", JSON.stringify(body));

    fetch("{your-server-url}/v1/validation/nodes", {

    method: "POST",

    headers: {

    'OTCSTicket': authTicket,

    },

    body: reqBody

    }).then(res => res.json())

    .then(data => {

    console.log(data)

    }).catch(error => {

    console.log(error)

    })

    }