내 커뮤니티 업적 표시줄을 확대합니다.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

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

주제

토픽은 커뮤니티 콘텐츠를 분류하여 관련성 있는 콘텐츠를 찾는 데 도움이 됩니다.

5 답변 개

Avatar

Level 6

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 6

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

Screenshot 2024-03-19 at 12.11.58 PM.pngScreenshot 2024-03-19 at 12.11.49 PM.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 6

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