Clay Icon

Issue with HubSpot API: 400 Error on Adding Company to List

·
·

Something is off with the HTTP API action. I'm trying to add a company to a list using the Hubspot API https://api.hubapi.com/crm/v3/lists/5113/memberships/add . According to the API docs, I have to send a "a list of record ids" in the body, which looks like ["1234"]

  • The Hubspot API auth is correct. Other API calls work just fine, so it's not an auth issue

  • The payload works fine in a curl request, so it's not an issue with the body payload

  • It is correct that Hubspot wants record ids as a string

  • In Clay, I can actually send an empty array as [] and it works, I get a 200 back

  • In Clay, I cannot send the actual array ["1234"] I get the following error:

Clay received a 400 error from the API with Content: {"status":"error","message":"Invalid input JSON on line 1, column 2: Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT)","correlationId":"139506c7-6bf3-4c8d-88e6-c55cc12dd004"}
  • Avatar of Channeled
    Channeled
    APP
    ·
    ·

    It seems there might be an issue with how Clay is parsing the JSON body in the HTTP API action. To troubleshoot this further, could you please copy and paste the exact JSON you're using in the Body field of the HTTP API action? This will help us identify any potential formatting issues specific to Clay's implementation. In general, when working with the HTTP API in Clay, it's important to ensure that the JSON is properly formatted, especially when using dynamic variables or arrays. Once you provide the JSON, we can better assist you in resolving this Hubspot API integration issue.

  • Avatar of Faye C.
    Faye C.
    ·
    ·

    This is what I'm sending in the Body:

    [
      "20267771488"
    ]
  • Avatar of Channeled
    Channeled
    APP
    ·
    ·

    The issue might be related to how Clay is parsing the JSON in the HTTP API action body. When using arrays in Clay's HTTP API, it's crucial to ensure proper JSON formatting. Could you please provide the exact JSON you're using in the Body field of the HTTP API action? This will help us identify any potential formatting issues specific to Clay's implementation. For dynamic variables in Clay, remember to follow JSON formatting rules. For strings, use quotation marks, but for numbers, don't use quotes unless they have trailing zeros. Let's review your JSON to ensure it's correctly formatted for Clay's HTTP API action.

  • Avatar of Channeled
    Channeled
    APP
    ·
    ·

    This thread was picked up by our in-app web widget and will no longer sync to Slack. If you are the original poster, you can continue this conversation by logging into https://app.clay.com and clicking "Support" in the sidebar. If you're not the original poster and require help from support, please post in 02 Support.