Creating a request with raw json body

I am trying to create a request inside a new/update collection API call, having the equivalent of the raw - json body inside the client.

Right now, it seems like I need to send something like (I am using ruby, but it shouldn’t make a big different):

body: {
  mode: 'raw',
  json: {
    field1: 'value',
    field2: 'value2'
  }
}

I want to avoid using 'formdata', because I already have the hash and parsing it into formdata format would add extra complexity (especially because I have to handle multiple nests).

When using this, I get a 200, but the generated request has an empty body.

I’ve also tried using mode: raw, text: {}, but same result. Also, I’ve tried

body: {
  json: { field: 'value' }             
}

and

body: { field: 'value' }

and it didn’t work.

Is there any way to make this work? Also, didn’t find any examples of how to send the body in the docs.

@Victor_Motogna Welcome to the Community :partying_face:

You can try something like

var body = {
    "field1" : "value",
    "field2" : "value2"
  };

body: {
  mode: 'raw',
  raw: JSON.stringify(body)
}

Please refer this link for examples :innocent:

2 Likes

That worked great, thanks!

1 Like