SOLVED

Re: Can't add custom activity

Go to solution
Anonymous
Not applicable

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.

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Can't add custom activity

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.

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: Can't add custom activity

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

Anonymous
Not applicable

Re: Can't add custom activity

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

SanfordWhiteman
Level 10 - Community Moderator

Re: Can't add custom activity

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.

Anonymous
Not applicable

Re: Can't add custom activity

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.

SanfordWhiteman
Level 10 - Community Moderator

Re: Can't add custom activity

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.

Anonymous
Not applicable

Re: Can't add custom activity

I seem to have been completely misunderstood. I debugged and it has ran correctly.

Thank you for your reply and your help in resolving the problem.

SanfordWhiteman
Level 10 - Community Moderator

Re: Can't add custom activity

Please mark one of the earlier responses as Correct for future searches.