How to send "Patch" using "application/json-patch+json" in Custom Request

Hi, I need to use the “Patch” method with content-type of application. I see Patch in the methods–am I supposed to add an additional parameter, i.e., “Content-Type”?

The request indicated a Content-Type of “application/x-www-form-urlencoded” for method type “PATCH” which is not supported. Valid content types for this method are: application/json-patch+json.

The Accept in the headers defaults to: application/json, text/plain, */*
And Content-type: application/x-www-form-urlencoded if the body is empty.

Have you tried setting the appropriate Content-type?

@andrew I tried this (screenshot) but that’s what gave me the error. I didn’t see any Content-Type in the list that is “application/json-patch+json”. What am I doing wrong?

image

I think the application/json Content-Type should work. In the Raw Request Body you should insert the HTPT JSON object body you’re sending to update the entity. Let me know if this works

@andrew tried that, now it’s back to the original error. Let me know if you have other suggestions.

That’s interesting, could you try adding this in the Headers section:

@andrew . Tried that. That message went away. But now getting this one: “You must pass a valid patch document in the body of the request.” Didn’t find much on google (sorry, new to this). Any thoughts?

Where are you sending the HTTP request to? I see that you’re trying to pass the OpenAI Assistant response? The HTTP Body should be a valid request to the 3rd party API app. Could you please share the link to the documentation of the API request?

@andrew Got it to work! I was only sending the content response and not the rest of the parameters in the JSON. After adding properly formatted JSON it worked! Thanks so much for your responses and your patience! Really helped me now I can move on.

1 Like