Skip to main content
Jul 20, 2016 5:40 PM UTC
Solved

Can't add custom activity

Hello,

I want add custom activity via REST API. Response status is "success", but all data is not registered. Because result status is "skipped".

response json is

{"requestId":"xxxxxxxxxxxxx","result":[{"status":"skipped","errors":[{"code":"1003","message"

:"Invalid attribute 'null'"},{"code":"1003","message":"Invalid attribute 'null'"},,,,,

request URL is

/rest/v1/activities/external.json?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

request body is

{"input":
       [{"leadId":13
            ,"activityDate":"2016-07-21T01:34:25+09:00"
            ,"activityTypeId":100001
            ,"primaryAttributeValue":"something"
            ,"attributes":[
                 {"contact_datetime":"2016-07-07 01:02:01","certain_field1":"AA-BB-CC1"}
                 ,{"contact_datetime":"2016-07-07 01:02:02","certain_field1":"AA-BB-CC2"
                 ,{"contact_datetime":"2016-07-07 01:02:03","certain_field1":"AA-BB-CC3"}
                 ,,,,,,

I don't know how to resolve.

If you know this solution, please let me know.

Thank you.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Jul 21, 2016 1:37 AM UTC

I'm testing another system written in PHP. In that case, there is 60 attributes in that body. I post this article edited by hand.

Admittedly, I'm missing right curly brace but, it's just mistake by hand.

In actuality, that request body generated by json_encode() function so, it is not a point of that problem.


Can't say I understand your dev/debugging environment if you have to hand-retype the request.

In any case your payload doesn't conform at all to the docs, which show:

{

   "input" : [

      {

         "leadId" : 1001,

         "activityDate" : "2013-09-26T06:56:35+07:00",

         "activityTypeId" : 1001,

         "primaryAttributeValue" : "Game Giveaway",

         "attributes" : [

            {

               "name" : "URL",

               "value" : "http://www.nvidia.com/game-giveaway"

            }

         ]

      }

   ]

}

attributes is an array of objects. Each object has two own properties, name and value.  You're doing something very different, and obvs. that's why it's breaking.

7 replies

SanfordWhiteman
User Group Leader
User Group Leader
Jul 20, 2016 5:45 PM UTC

If those extra commas are actually in the request, they are creating null members.  Only the last comma is ignored.

Translate
Jul 20, 2016 6:02 PM UTC

It's just truncated. radical body is more go on.

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Jul 20, 2016 6:05 PM UTC

I don't understand you completely, but I'd need to see an entire body of a failed request, not a truncated one. You also have a missing right curly brace.

Translate