Hi, I'm curious about what the APIs expect on POST/PATCH requests (never actually used, or even seen, the PATCH method before lol). For instance, for setting your status (or "presence" as the API seems to call it), the docs say this:
"Patch a Genesys Cloud user's presence. The presence object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the PURECLOUD source as the user's primary presence source. Option 2: Provide the presenceDefinition value. The 'id' is the only value required within the presenceDefinition. Option 3: Provide the message value. Option 1 can be combined with Option 2 and/or Option 3."
Okay, so researching other places, I found that the "source" is always "purecloud" (some kind of reserved keyword for future use). So I figured option 2 is the way to go... but this explanation is so vague that I have no idea what it's expecting. I've tried passing all kinds of things into the request body (for example, primary=true&presenceDefinition=<ID of the status/presence I want>, "presenceDefinition=" + JSON.stringify({ id: and the list of experiments and guesswork goes on and on and on and on etc. etc. etc. etc. lol). Or is it "body=" + JSON.stringify(data as an object)? I've been over many overviews, but there doesn't seem to be a single straight answer to this. Any clues would be greatly appreciated.
You can literally create a sample patch there and see an example of how to replicate it in the language of your choice.
High level when you're doing a patch the body of your request should contain essentially the same JSON as you'd get back from a GET normally, pared down to just the elements that are mandatory and/or being changed.
No, I hadn't seen this page. The page I found had these funky folding buttons with much more limited information; shoot, I even had to do "inspect element" just to copy that little tidbit that was the only thing available.
So yeah, having this page (with much better detail) will definitely help me figure it out. Now about your high-level explanation, do you mean literally the URL followed by a JSON string, like
Also, wouldn't that have to be URL-encoded? Like I said, as long as I've been using HTTP I've never seen PATCH before, much less "nameless" parameters like this.
With the JSON at the end being the data/body in question and the rest being headers. The API page has language friendly examples but they're a lot more verbose.
All joking aside, I got it working using the examples on that page, which is why I marked your last reply as the solution. And thanks for explaining about PATCH requests in general; now that I have those SDKs set up, I don't think I'll be using AJAX calls anymore (at least not for talking to the Genesys APIs), but I have other projects where understanding this "new" (well, new to me) HTTP method will really come in handy. Have a good one!