REST API - Unable to process JSON - CRM Import

Hello -

I have searched for seemingly days for an answer to the following. I hope this post leads me to the answer. I am trying to upload a contact file for updating via a REST API from Powershell (have tried Azure as well with the same outcome).

I continue to receive Unable to process JSON. When I look at the log in my account, I see that the import request body is truncated. I don’t know if this occurs from my side or the portal only displays so many charaters.

Like so many others, I am able to successfully upload data via Postman. I take the code from Postman and am not able to upload data - receive this error. To avoid a lengthy post, I have tweaked the code to try so many possibilities, such as placing the JSON in the header versus the form (multipart/form-data).

Thanks

Bryan

Hey, @BCamaglia :waving_hand: Thanks for your question. Were you able to make any progress? I don’t have a solution or direct experience in this context.

I did some digging today in my resources, hoping we could find an easy win or next step forward. Have you tried using ConvertTo-Json -Depth 10 to make sure your complex objects are fully converted?

We’ll also leave this open in case another community member has recent experience they can share.

Best,

Jaycee

Hi Jaycee -

Thank you for your reply. I tried your suggestion. It did not change the error message. I feel like the information provided through the API log is truncated. It would be great to confirm this versus my side not sending all the information. Also, it would be great to confirm the exact format required to accomplish this multipart/form-data API POST call. Below is the view I get when I look at the body received by Hubspot API.

Additional throughs are more than welcomed.

Thanks

Bryan

--fd4f2f57-cd61-4258-b74d-91fbde74eb64
Content-Disposition: form-data; name=“importRequest”
Content-Type: application/json;charset=utf-8

"{\“name\”: \“Batch_20231113_E2\”, \“importOperations\”: {\“0-1\”: \“UPDATE\”}, \“files\”: [{\“fileName\”: \“Batch_20231113_E2.csv\”, \“fileFormat\”: \“CSV\”, \“dateFormat\”: \“MONTH_DAY_YEAR\”, \“fileImportPage\”: {\“hasHeader\”: true, \“columnMappings\”: [{\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“RecordID\”, \“propertyName\”: \“RecordID\”, \“idColumnType\”: \“HUBSPOT_OBJECT_ID\”}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“firstName\”, \“propertyName\”: \“firstname\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“lastName\”, \“propertyName\”: \“lastname\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“email\”, \“propertyName\”: \“email\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“phoneMobile\”, \“propertyName\”: \“phonemobile\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“gender\”, \“propertyName\”: \“gender\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“birthdate\”, \“propertyName\”: \“birthday\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“birthdateMonth\”, \“propertyName\”: \“birthday_month\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“anniversaryMonth\”, \“propertyName\”: \“anniversary_month\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“dateFirstVisit\”, \“propertyName\”: \“first_visit_date\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“dateLastVisit\”, \“propertyName\”: \“last_visit_date\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \“empLastVisit\”, \“propertyName\”: \“last_visit_employee\”, \“idColumnType\”: null}, {\“columnObjectTypeId\”: \“0-1\”, \“columnName\”: \"nicknameLa