Has the behavior for get custom objects changed?

Anonymous
Not applicable

Has the behavior for get custom objects changed?

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:

Then I invoke Get Custom Objects using those fields:

  • https://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 http://developers.marketo.com/documentation/rest/error-codes/ as "Invalid JSON", yet the JSON parses fine. Any help would be greatly appreciated.

3 REPLIES 3
Anonymous
Not applicable

Re: Has the behavior for get custom objects changed?

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 1

Re: Has the behavior for get custom objects changed?

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

Anonymous
Not applicable

Re: Has the behavior for get custom objects changed?

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"
      }
   ]
}