Skip to main content
June 10, 2016
Question

Has the behavior for get custom objects changed?

  • June 10, 2016
  • 1 reply
  • 1614 views

I have some code that was working at one time, but currently does not.

I first use the describe endpoint to get the fields for a custom object:

  • 901-WNZ-322.mktorest.com/rest/v1/customobjects/readyTalkMeetingInfo_c/describe.json

Then I invoke Get Custom Objects using those fields:

  • 901-WNZ-322.mktorest.com/rest/v1/customobjects/readyTalkMeetingInfo_c.json?_method=GET
  • { "fields": "createdAt,marketoGUID,updatedAt,chatQuestion1,chatQuestion2,chatQuestion3,chatsCount,duration,firstEntry,flaggedQuestionCount,lastExit,lead,meetingID,meetingTitle,pollAnswer1,pollAnswer2,pollAnswer3,pollAnswer4,pollAnswer5,pollAnswer6,pollAnswer7,pollQuestion1,pollQuestion2,pollQuestion3,pollQuestion4,pollQuestion5,pollQuestion6,pollQuestion7,surveyAnswer1,surveyAnswer2,surveyAnswer3,surveyAnswer4,surveyAnswer5,surveyAnswer6,surveyAnswer7,surveyQuestion1,surveyQuestion2,surveyQuestion3,surveyQuestion4,surveyQuestion5,surveyQuestion6,surveyQuestion7", "filterType": "marketoGUID", "filterValues": "01e13ebd-39e9-46da-8978-bd6de880df4c" }

This previously worked, but now it's returning an error of:

  • {"requestId":"939b#15527dad993","success":false,"errors":[{"code":"609","message":"Invalid value specified for attribute 'fields'"}]}

This is also confusing due to the fact that code 609 is documented in developers.marketo.com/documentation/rest/error-codes/ as "Invalid JSON", yet the JSON parses fine. Any help would be greatly appreciated.

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

1 reply

June 13, 2016

Hi Atul

According to http://developers.marketo.com/documentation/custom-api/get-custom-objects/

I think you don't need "_method=GET" parameter in GET method.

Dave_Everly
Level 2
June 20, 2016

Atul,

I assume that you are using HTTP POST method.

The problem here is "fields" attribute in the JSON in the request body.  It should be an array of strings.

Instead of this:

{

  "fields": "createdAt,marketoGUID,updatedAt,,…”,

  "filterType": "marketoGUID",

  "filterValues": "01e13ebd-39e9-46da-8978-bd6de880df4c"

}

Use this:

{

  "fields": ["createdAt”,”marketoGUID”,”updatedAt”,…],

  "filterType": "marketoGUID",

  "filterValues": "01e13ebd-39e9-46da-8978-bd6de880df4c"

}

-Dave

June 21, 2016

Yeah

Docs explains "fields" is comma separated.

fields

Optional

Comma separated list of field names. 

If not specified, then response contains the following fields:

  • marketoGuid
  • dedupeFields
  • updatedAt
  • createdAt

But if you are using POST, you need to change to JSON array format as same as Dave said.

Example Request URL(POST)

/rest/v1/customobjects/Car.json?_method=GET

Example Request (POST)

{  
   "filterType":"dedupeFields",
   "fields":[ 
      "marketoGuid",
      "Bedrooms",
      "yearBuilt"
   ],
   "input":[ 
      { 
         "mlsNum":"1962352",
         "houseOwnerId":"42645756"
      },
      { 
         "mlsNum":"2962352",
         "houseOwnerId":"52645756"
      },
      { 
         "mlsNum":"3962352",
         "houseOwnerId":"62645756"
      }
   ]
}