REST API Call to Update Leap Document

I'm working on a C# program that updates a LEAP document via REST API call.

The program first does a GET REST API call that returns this JSON Object:
===========
GET
===========
{{
"application_uid": "5c287256-7edf-4064-80c5-0e64f1f7833f",
"formId": "F_Form1",
"recordCount": 1,
"items": [
{
"lastModified": "2024-08-28T20:50:45Z",
"lastModifiedBy": {
"displayName": "joe doe",
"email": "joe.doe@test.com",
"login": "jdoe"
},
"created": "2024-08-28T15:43:11Z",
"createdBy": {
"displayName": "joe doe",
"email": "joe.doe@test.com",
"login": "jdoe"
},
"draft_ownerid": "",
"flowState": "ST_Submitted",
"id": 0.0,
"uid": "670f21ab-d9e1-407e-8d3a-340731e79caa",
"F_SingleLine1": "A",
"F_Number1": 1.0,
"availableSubmitButtons": [
"S_Update",
"S_Submit1"
]
}
]
}}

I then change the value of the "F_SingleLine1" field to a different value "B" and add "pressedButton": "S_Update" to the JSON Object:

===========
PUT
===========

{{
"application_uid": "5c287256-7edf-4064-80c5-0e64f1f7833f",
"formId": "F_Form1",
"recordCount": 1,
"items": [
{
"lastModified": "2024-08-28T20:50:45Z",
"lastModifiedBy": {
"displayName": "joe doe",
"email": "joe.doe@test.com",
"login": "jdoe"
},
"created": "2024-08-28T15:43:11Z",
"createdBy": {
"displayName": "joe doe",
"email": "joe.doe@test.com",
"login": "jdoe"
},
"draft_ownerid": "",
"flowState": "ST_Submitted",
"id": 0.0,
"uid": "670f21ab-d9e1-407e-8d3a-340731e79caa",
"F_SingleLine1": "B",
"F_Number1": 1.0,
"availableSubmitButtons": [
"S_Update",
"S_Submit1"
],
"pressedButton": "S_Update"
}
]
}}


Calling the PUT REST API returns an error: "StatusCode: InternalServerError, Content-Type: text/html, Content-Length: 647)"

Is there anything with how I have the JSON Object setup for the PUT operation that jumps out at you?

Going through the documenation here: https://leap.hcldoc.com/help/topic/LEAPv9/LEAP/ref_data_rest_api_update.html

shows a typical JSON payload of:
{
"uid": "f82e576f-cb67-4008-8219-f49a1b369f7d",
"flowState": "ST_ReviewStage",
"pressedButton" : "S_Approve",
"F_SingleLine1": "Jane",
"F_SingleLine2": "Test",
"F_Number1": 26.75
}

Wanting to use GET to pull in all of the field values, then use it to perform the PUT....

 

Hi Derek,

Have you tried to set the required request http headers like "Content-Type", "Accept", and "Cookie" in C# end.

You may want to check this documentation if you are using it:

https://restsharp.dev/docs/usage/request

Additionally, I found a forum that might help similar with the error you encountered - "StatusCode: InternalServerError, Content-Type: text/html, Content-Length: 647)":

https://groups.google.com/g/restsharp/c/KIpCngK6WTg

Hope this helps.

Thanks,

Jayve

Hello Derek,

Also, you may want to check this HCL Leap wiki below:

https://hclwiki.atlassian.net/wiki/spaces/HL/pages/461967/Calling+Leap+REST+API+from+Java+Code

This is calling Leap REST API from Java, but you can refer to it as idea to apply in C#.

Hope this helps as well.

Thanks,

Jayve