1003 Error Code - custom objects not specified

Thomas_Goirand
Level 2

1003 Error Code - custom objects not specified

Hi there,

I am stuck on a issue here with a custom object record creation query and a 1003 error code I do not know hot to avoid. The 1003 error is displaying a "customobjects not specified" which I highlighted in bold in my request and is approved with this specific API name in our marketo instance.

Here is my request hereby. The "XXXX" are just covering our endpoints and tokens I prefer to keep secret 😉 

Thanks you very much for any help / advice / hint in resolving this.

<?php

$request = new HttpRequest();
$request->setUrl('https://XXXX.mktorest.com/rest/v1/customobjects/cRM_Leads_c.json');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
'cache-control' => 'no-cache',
'Connection' => 'keep-alive',
'Content-Length' => '233',
'Accept-Encoding' => 'gzip, deflate',
'Host' => 'XXXXX.mktorest.com',
'Authorization' => 'Bearer XXXXXXXXXXXXXXXXXXXXXXXX',
'Content-Type' => 'application/json'
));

$request->setBody('{
"action": "createOnly",
"dedupeBy": "crm_lead_id",
"inputs": [
{
"contact_id": "5492761",
"email": "",
"crm_lead_id": "35d277d6-64f6-e911-a813-000d3a2c59f1"
}
]

}');

try {
$response = $request->send();

echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}

Tags (1)
3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: 1003 Error Code - custom objects not specified

Please highlight your code using the Advanced Editor's syntax highlighter. Then I'll tell you the answer.

P.S. Better to post the actual JSON payload you're sending to the server, language- or HTTP-library-specific stuff ends up being distracting.

chrisvalley
Level 1

Re: 1003 Error Code - custom objects not specified

Hello - I am also seeing this error while trying to create a new custom object using the Marketo API, albeit within Python using the requests package. 

 

custom_object_definition = {
    "name": "test_delete",
    "displayName": "Test Delete",
    "description": "Custom object for testing purposes",
    "fields": [
        {
            "name": "field1",
            "displayName": "Field 1",
            "dataType": "string"
        },
        {
            "name": "field2",
            "displayName": "Field 2",
            "dataType": "integer"
        }
    ]
}

# Create the custom object
def create_custom_object(access_token, custom_object_definition):
    url = f"https://{munchkin_id}.mktorest.com/rest/v1/customobjects/{custom_object_definition['name']}.json"
    headers = {
        "Authorization": f"Bearer {access_token}",
        "Content-Type": "application/json"
    }
    payload = json.dumps(custom_object_definition)
    response = requests.post(url, headers=headers, data=payload)
    if response.status_code == 200:
        return response.json()
    else:
        print("Failed to create custom object:", response.status_code)
        return None

custom_object_response = create_custom_object(access_token, custom_object_definition)

 

Here is the error message:

{'requestId': 'xxxxxxxxxxxxxxxxx',  'success': False,  'errors': [{'code': '1003', 'message': 'Custom objects not specified'}]} 

I've tried doing this outside of a function and get the same result. Note that the access token is is working for other Marketo API calls, it appears to be an issue with how this call is being made, or the way in which the custom object is defined.

SanfordWhiteman
Level 10 - Community Moderator

Re: 1003 Error Code - custom objects not specified

Please post the resulting JSON payload. Marketo never sees your Python code, it sees the HTTP request.