APIs & Integrations

bjackson
Participant

Batch Create or Update Contacts 202 Accepted Received But Nothing is Updated

SOLVE

Using Batch Create or Update Contacts and I receive the  202 accepted received but nothing is updated.

 

C# Code

        private static void UpdateHubSpotContacts(StringBuilder sb)
        {

            var hapikey = "mykey";
            var client = new RestClient("https://api.hubapi.com/");
            var request = new RestRequest("contacts/v1/contact/batch/", Method.POST);

            request.AddQueryParameter("hapikey", hapikey);
            request.AddParameter("application/json", sb, ParameterType.RequestBody);
            request.RequestFormat = DataFormat.Json;
            request.AddHeader("Content-Type", "application/json");



            IRestResponse response = client.Execute(request);
            Console.WriteLine(response.Content);
            Console.ReadLine();

        }

JSON

[
 {
   "email": "test1@test.com",
   "Properties": [
     {
       "property": "firstname",
       "value": "test1"
     },
     {
       "property": "lastname",
       "value": "tester1"
     }
   ]
 },{
   "email": "test2@test.com",
   "Properties": [
     {
       "property": "firstname",
       "value": "test2"
     },
     {
       "property": "lastname",
       "value": "tester2"
     }
   ]
 },
 {
   "email": "test3@test.com",
   "Properties": [
     {
       "property": "firstname",
       "value": "test3"
     },
     {
       "property": "lastname",
       "value": "tester3"
     }
   ]
 }
]

 

 

0 Upvotes
1 Accepted solution
jdobrovich
Solution
HubSpot Employee
HubSpot Employee

Batch Create or Update Contacts 202 Accepted Received But Nothing is Updated

SOLVE

Hey there,

It looks like the formatting of the JSON payload should be changed from:

 

[
 {
   "email": "test1@test.com",
   "Properties": [
     {

to

 

[
 {
   "email": "test1@test.com",
   "properties": [
     {

Can you give this a shot? Thanks!

View solution in original post

2 Replies 2
jdobrovich
Solution
HubSpot Employee
HubSpot Employee

Batch Create or Update Contacts 202 Accepted Received But Nothing is Updated

SOLVE

Hey there,

It looks like the formatting of the JSON payload should be changed from:

 

[
 {
   "email": "test1@test.com",
   "Properties": [
     {

to

 

[
 {
   "email": "test1@test.com",
   "properties": [
     {

Can you give this a shot? Thanks!

IvNyr
Member

Batch Create or Update Contacts 202 Accepted Received But Nothing is Updated

SOLVE

Hi, I am facing with the same problem. I made a very simple query:

 

https://api.hubapi.com/contacts/v1/contact/batch/?hapikey={deleted}

 

POST body:

[
    {
        "vid": 10000,
        "properties": [
            {
                "property": "firstname",
                "value": "Brian"
            }
        ]
    }
]

 

And received status 202 Accepted, but there is no this contact in the list of contacts.

0 Upvotes