Expand my Community achievements bar.

Custom API Call (POST) request erroring out on Body request

Avatar

Level 1

https://developer.adobe.com/workfront/api-explorer/

I'm trying to create a POST request for the "BudgetedHour (BGHR)" request

 

I'm having trouble figuring out how to properly format the body request or if I'm missing any additional steps. In my screenshot below I'm just using dummy data to get the request working successfully. The error its giving currently is "The operation failed with an error. [422] allocationDate cannot be null".fusion2.pngfusion.png

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

5 Replies

Avatar

Level 5

The issue is around encoding.  The Body is just a text string.  It doesn't auto-encode JSON.  If you want JSON, you need to use something like a "Create JSON" or "Transform to JSON" module ahead of time.  Otherwise, try something like this in the body:

{
  "allocationDate": "{{formatDate({{now}};YYYY-MM-DDTHH:mm:ssZ;UTC)}}",
  "ID": "12345"
}

Avatar

Level 1

I tried updating the request based on your response but still receiving the same error.

fusion3.png

Avatar

Level 1

fusion4.png

Thanks for the suggestions! Still receiving an error regarding parameters used

 

The operation failed with an error. [422] Invalid Parameter: updates value "{    "allocationDate": "2023-08-08",    "budgetedHours": 0,    "plannedBudgetedHours": 0.000004,    "projectID": "636947bf001be965ae14b1167f0452de",    "roleID": "589b913f004177007e21a68fc51e641f",    "userID": "5865311301e3b4412776839b39e9de32"},JSON parsing error at line 1, column 3"

Avatar

Level 5

Not entirely sure, TBH.  I suggest you do a bghr/search call, get one of the response bodies, and use that as a template for pushing.  That's what I did, and it worked (as per my screenshots above).