Http request error: The payload is not valid JSON.","detail": Status Code 500

I’m using http request activity in studio and receiving error when I add my parameters. Here is the JSON File:
Request Body :

{
“requested_for”:“uhd40”,
“short_description”:“BOSS User Access Requests”,
“description”:“BOSS User Access Requests”
}

Response

{
“result”: {
“Message”: “Request Submitted successfully”,
“Request”: “REQ0103107”,
“Requested_item”: “RITM0119016”
}
}
Can you tell me if I have my Parameters set up correctly? When I remove the Parameters, I get the correct response. When I add them, I’m receiving the error. This code was verified in Postman.

there error received when I preview is :
{“error”:{“message”:“com.glide.rest.util.RESTRuntimeException: The payload is not valid JSON.”,“detail”:“”},“status”:“failure”}

@chris.dease,

The error is pointing towards the payload or body of the request.

Check if you are passing anything that’s not allowed in json.

You can check it with any online tools like json validator.

Thanks,
Ashok :slightly_smiling_face:

I’m showing that Json is valid:

@chris.dease,

Ok. That’s checked.

How you are passing this as string in body? Are adding additional " for each " like ““key””:““value””

below is how i have them typed in. i looked at other forum posts and tried the double quotes twice and received error when trying to pass.


based on other examples this appears to be the correct method. Below is an example i worked on and was able to get the expected response:

@ashokkarale ,
i was able to save the json body as a text file and use the read text file activity and able to pass into body field of HTTP request and getting a valid response now. Could you possibly help with how to pass a variable to the text file? i would like to have the “requested_for” value be a variable like “employeeid” instead of the value “aci43” and be able to pass any value into the employeeid variable. Below is my text file. Just not sure how to accomplish that in Studio.

{
“requested_for”:“aci43”,
“short_description”:“BOSS User Access Requests”,
“description”:“BOSS User Access Requests”
}

@chris.dease,

Glad you were able to fix the earlier issue :slight_smile:

Regarding your query on dynamic value passing to json in text file.

Follow these steps:

  1. Update your json text template like this.
    image

  2. Read Text File activity to read the template text file.
    image

  3. Use assign activity to replace template text with actual value

  4. Json is ready

Output:
image

Sample code:
jsonDemo.xaml (6.9 KB)

Thanks,
Ashok :slight_smile:

Thank you! Very helpful!

@chris.dease,

Glad I’m able to help. Please mark my answer as solution so it will be helpful to other community members as well.

Thanks,
Ashok :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.