Adjusting WFM schedule using API

Hi, I am trying to adjust user WFM schedule using API and instruction below:

I have troubles when I try to use pre-signed URL to upload data (Step 2).
So first I create adjustments JSON file and ZIP it. The size of zipped file is 364 bytes.
I pass it to
POST /api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekId}/schedules/{scheduleId}/update/uploadurl
and get pre-signed link
then I use Postman, select POST method, pass the link and choose Binary type for body and upload zipped file.
I choose authorization type - Bearer.
Request always is returning an error: "Signature doesnt match".
What I am doing wrong here? Is signature generated solely based on File size input?
Thank you.

Hi, thanks for reaching out.

So if I'm understanding correctly, it sounds like you're getting an error when attempting to POST to the presigned URL provided to you, and you're adding authorization headers to your request.

Assuming that understanding is correct:
Firstly, the request to the presigned URL should be a PUT, not a POST.
The route you called to get the url also provides the list of headers you need to provide in your PUT to the presigned URL. This link is actually an AWS provided link behind the scenes, so your bearer token you use for other Genesys API requests does not apply.

Once you've succesfully done that, your initial call to get the uploadUrl would also have returned an uploadKey, which you'll supply when you call the update route after you've PUT your payload to the presigned URL

1 Like

hi Brian, thank you, I realized it is PUT instead of POST but doesnt work either
parameters and headers are automatically populated when I paste URL, but still doesnt work
so I am unable to PUT payload to pre-signed URL

You shouldn't need to select an authorization type at all.

Beyond that, I think I see a couple of likely causes:

  1. Something is happening when pasting your URL and the headers aren't populating correctly (I consider this the most likely if you're manually pasting something). The headers have to match exactly what is provided in the returned map, due to the way AWS presigned URLs work. Any additional headers, or even changing the order of any query parameters in the url, will cause the request to fail
  2. Your file size that you supply when you send your POST to create the upload URL must be exactly, down to the byte, the same as what you upload on your PUT. Any mismatch, even by a single byte, will cause the request to fail

Please let me know if that helps

1 Like

hi Brian, thank you for your help, it eventually worked.
My error was - I didnt pass headers from 1st API response, it was populating parameters but headers are manual
now I struggling to run that payload without mistake :joy:

I have got different problem now, payload doesnt want be processed
in notifications it just gives me an error, without any details
I modified file just like sample, but our Shift ID is like "1" and not hex ID, is it right?
I tried all options, it doesnt work somehow
can I find any details on the error somehow?

I was checking this topic but how to get Notification metadata it is not clear

The metadata is not part of the notification body but rather something that is part of the notification itself. I'm not sure how that streaming tool works, but if you look at the sample code at this link for historical adherence you'll see code for an example event listener. There is one spot at the bottom where event.getBody() is referenced - It's at that same level you'll access event.getMetadata(). The error details will be on that metadata.

We are unfortunately not able to debug customer data directly in the forums. so all I can do is point you in the right direction

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