Can't add custom activity | Community
Skip to main content
July 20, 2016
Solved

Can't add custom activity

  • July 20, 2016
  • 1 reply
  • 4661 views

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.
Best answer by SanfordWhiteman

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.

1 reply

SanfordWhiteman
Level 10
July 20, 2016

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

July 20, 2016

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

SanfordWhiteman
Level 10
July 20, 2016

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.