Custom API Call (POST) request erroring out on Body request | Community
Skip to main content
New Participant
March 19, 2024
Question

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

  • March 19, 2024
  • 1 reply
  • 1188 views

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".

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

New Participant
March 19, 2024

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" }
DaltonDoAuthor
New Participant
March 19, 2024

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

New Participant
March 19, 2024

Change to formatDate(now; YYYY-MM-DD).