Post

2 followers Follow
0
Avatar

creating tasks via BULK/execute

I have a REST call that I use to create a task in Clarizen.  The code works fine when I directly call the CreateAndRetrieve endpoint, but when I attempt to wrap it in a bulk/execute call, the individual call fails (I get a 200 OK from the bulk call, but the response details show 500 Internal error).  The call is:

{'entity':{'id':'/Task/','TaskType':'/TaskType/General','C_LNRItemType':'/C_WorkItemLNRItemType/Task','C_LNRLevel':'4','C_LNRStatus':'New','C_LNRTaskType':'/C_GenericTaskLNRTaskType/Email - Revision','C_CRCNum':0,'C_Level3':'47pqfp9m5ljgt9qysppc98puf26','Parent':'/Milestone/47pqfp9m5ljgt9qysppc98puf26','name':'[TSK] Email Revision - https://app.clarizentb.com/','description':'~`!@#$%^&*()_+-=[]{}\\|;\':\"\"\" \'\' ,.<>/?/*-+ https://app.clarizentb.com/','Manager':'/user/3cxk8l8f69u26cioftnbh8wx55664','Duration':{'Value':'1','Unit':'Days'},'C_OriginalMSID':'https://app.clarizentb.com/'},'fields':['SYSID']}

 

and wrapped is: 

{requests:[{"url":"/data/createAndRetrieve","method":"POST", "body":"{'entity':{'id':'/Task/','TaskType':'/TaskType/General','C_LNRItemType':'/C_WorkItemLNRItemType/Task','C_LNRLevel':'4','C_LNRStatus':'New','C_LNRTaskType':'/C_GenericTaskLNRTaskType/Email - Revision','C_CRCNum':0,'C_Level3':'47pqfp9m5ljgt9qysppc98puf26','Parent':'/Milestone/47pqfp9m5ljgt9qysppc98puf26','name':'[TSK] Email Revision - https://app.clarizentb.com/','description':'~`!@#$%^&*()_+-=[]{}\\|;\':\"\"\" \'\' ,.<>/?/*-+ https://app.clarizentb.com/','Manager':'/user/3cxk8l8f69u26cioftnbh8wx55664','Duration':{'Value':'1','Unit':'Days'},'C_OriginalMSID':'https://app.clarizentb.com/'},'fields':['SYSID']}"}]}

Dierker, Ed Answered

Please sign in to leave a comment.

2 comments

0
Avatar

Hello Ed,

I've tested the following in Postman and it works:

{
  "requests": [
    {
      "url": "/data/createAndRetrieve",
      "method": "POST",
      "body": {
        "entity":{
          "id":"/Task/",
          "TaskType":"/TaskType/General",
          "name":"Test"
        },
        "fields":["SYSID"]
      }
    }
  ]
}

The payload above needs to be stringified before sending.

I hope this helps.

Roland

Roland Pumputis 0 votes
Comment actions Permalink
0
Avatar

actually, the whole point of the above code was to validate the capture of "special characters".  My concern is that "stringifying" the code one way works for the actual creatAndRetrieve post, but you have to do it differently for the bulk/execute of the same command.  a single \ properly escapes the characters for createAndRetrieve, but you need \\\ to escape on the Bulk\Execute.  Since my code dynamically determines whether or not to bulk/execute or call the createAndRetrieve directly, this is sub-optimal (and doesn't make much sense to me anyway).

Dierker, Ed 0 votes
Comment actions Permalink