REST API Error code 1006 | Community
Skip to main content
August 7, 2014
Question

REST API Error code 1006

  • August 7, 2014
  • 8 replies
  • 3614 views
We're trying to use the REST API to insert some leads, but we're getting an odd response.

Request:
{"action":"createOrUpdate","input":[{"email":"test@abc.com","firstName":"test","postalCode":"11111","company":"Test"}]}
 
Response:
{"requestId":"17322#147b213b6cc","success":false,"errors":[{"code":"1006","message":"Field 'Company' not found"}]}

Even when we take out the "company" line, we get the error about Company not found.


This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

8 replies

August 7, 2014
What do you mean you've taken out the Company line? You've made the call again without that bit in it?
Robb_Barrett
Level 10
August 7, 2014
Yes.  The first time we recevied the error we weren't even sending over Company.
Robb Barrett
August 7, 2014
Hmm. Can you send me the exact request and error where you got that?
Robb_Barrett
Level 10
August 8, 2014
Here's the code our developer is using:

var client = new RestClient("https://[REDACTED}.mktorest.com/");
 
var identityRequest = new RestRequest("identity/oauth/token");
identityRequest.AddParameter("grant_type", "client_credentials");
identityRequest.AddParameter("client_id", @"[REDACTED FOR THIS POST]");
identityRequest.AddParameter("client_secret", @"[REDACTED FOR THIS POST]");
var identityResponse = client.Execute<AuthResponse>(identityRequest);
if (identityResponse.Data != null)
{
    var accessToken = "?access_token=" + identityResponse.Data.access_token;
 
    var leads = new Leads
    {
        action = "createOrUpdate",
        input = new List<Lead>()
        {
            new Lead()
            {
                email = "test@abc.com",
                firstName = "test",
                postalCode = "11111",
                company = "Test"
            }
        }
    };
    var leadsRequest = new RestRequest("rest/v1/leads.json" + accessToken, Method.POST);
    leadsRequest.RequestFormat = DataFormat.Json;
    leadsRequest.AddBody(leads);
    var leadsResponse = client.Execute(leadsRequest);
 
    //var campaignRequest = new RestRequest("rest/v1/campaigns.json" + accessToken);
    //campaignRequest.RequestFormat = DataFormat.Json;
    //var campaignsResponse = client.Execute(campaignRequest);
}

The response is: 
This gives me a server response:
{"requestId":"ddb4#147b1e9ab08","success":false,"errors":[{"code":"1006","message":"Field 'Company' not found"}]}

PM me if you need the full, uncensored info that I'm using.
Robb Barrett
Robb_Barrett
Level 10
August 8, 2014
P.S. - We added Company to that code to try to solve for this issue.
Robb Barrett
Robb_Barrett
Level 10
August 8, 2014
Here's the first email our developer sent me:

"According to the documentation I should be able to create a new lead by submitting an object like this:
{"action":"createOnly","input":[{"email":"test@abc.com","firstName":"test","postalCode":"11111"}]}
 
This gives me a server response:
{"requestId":"ddb4#147b1e9ab08","success":false,"errors":[{"code":"1006","message":"Field 'Company' not found"}]}
 
I don’t really know what this ‘Company’ field is and I tried adding an extra field to my request data called Company – that however gives me the exact same error.
 
Also – when trying to call the campaigns endpoint, I get access denied whether I supply a name of a campaign or not.
{"requestId":"b335#147b1f0a816","success":false,"errors":[{"code":"603","message":"Access denied"}]}""


We solved the Access Denied part by adding to the permissions. You'll need to update the documentation to show that the user role needs ALL the API fields selected, not just "Create Leads" information.
Robb Barrett
August 8, 2014
Hey Robb,

I think this is a bit involved to do on the community. Have you reached out to support? You've got enough documentation I think they should be able to help you pretty quickly. It's weird this isn't just working so something unique must be going on.
Robb_Barrett
Level 10
August 8, 2014
Thank you. I'll move this to a ticket and post any updates to this thread.
Robb Barrett