HTTP request configuration for key/value pair object in body

Hi,

First of all I am a complete coding noob, so I may not be using the correct terminology but I will try and explain the best I can.

I am working my way through figuring out how to integrate my CRM and some marketing software through their APIs, and I am having an issue with the key/value pair system. What I’m trying to do is create a customer through POST, and when I’m looking at the API reference it tells me that the address field is an object with valid keys to describe it. ( A set of key/value pairs which describes address. Allowed keys: city , state , line_1 , line_2 , country , postal_code).

In the body I put in the keys and their associated values, but when I test run it the response shows address:null. I’ve attached a picture to hopefully better show what I’m trying to describe. I’m trying to figure out how to enter the key/values so I get a response with the address fields matched up. I have tried entering them in different orders, and that didn’t change anything.

Hi @Stewsgarage

First off, welcome to the Pipedream community. Happy to have you!

Your terminology is sounding right to me!

It could be that your request is missing the address object. Hard to tell without being able to see the request’s configuration itself.

Could you share that code or the configuration of the HTTP request step in your workflow?


Sorry, it only let me upload one picture at a time.

Here’s how it’s configured on the HTTP request.

Thanks, that’s helpful still.

I believe the issue is that city, state , line_1, etc are fields that need to be nested under an address object.

In the request body editor, it’s expecting strings by default, but you can use Javascript Expressions to work around this.

For example, try creating an address Key in your request body, for the Value define an object, not a string:

{{
  {
    city: 'testcity',
    state: 'teststate',
    line_1: 'line1test',
    line_2: 'line2test',
  }
}}

That is what I needed. I wasn’t sure how to define the value as an object vs a string. Thank you!

1 Like