Edit: After making some changes to the swagger file which didn't help, I put back my original swagger file and deleted and added the action to use the custom connector in my flow and to my surprise it is now working! I cant understand what is different. I have not been doing anything with the date formats - the values in the request have been a copy and paste of the original values on the item I am updating with this request.
I have an issue with a flow that is sending a request via a custom connector using on-premises gateway. There are two date/time values sent in the request. They are sent in YYYY-MM-DDTHH:MM:SS.SSSZ format which is what the endpoint expects. Checking my flow history I see these values being sent to my custom connector (from the raw input of the step that calls the custom connector):
"request/validFor/endDateTime": "2023-12-30T11:00:00.000Z",
"request/validFor/startDateTime": "2022-11-15T00:30:00.000Z",
When the request is received at the endpoint after going through the custom connector and the on-premises gateway, I see that the format of theses values has changed to YYYY-MM-DDTHH:MM:SSZ. This results in failure as the endpoint can’t parse the times correctly. This is what is received by the endpoint:
“validFor": {
"endDateTime":"2023-12-30T11:00:00Z",
"startDateTime":"2022-11-15T00:30:00Z"
}
I have used the Test page on the custom connector and if I enter these values in the request in the expected YYYY-MM-DDTHH:MM:SS.SSSZ format, the formatting is retained and the endpoint responds correctly. So I believe the reformatting is not anything to do with the on-premises gateway.
I don’t understand what is causing this format to change. Does anyone have any suggestions?
In case it matters, here are relevant extracts from the operation definition in the custom connector Swagger 2.0 file:
In the operation definition:
schema:
$ref: '#/definitions/UpdateProductOfferRequest'
UpdateProductOfferRequest:
type: object
required:
- id
- lifecycleStatus
- name
- validFor
The property ‘validFor’ is defined as
validFor:
description: >-
The period for which the Product is valid for
$ref: '#/definitions/TimePeriod'
The TimePeriod is defined as:
TimePeriod:
type: object
required:
- endDateTime
- startDateTime
properties:
endDateTime:
type: string
format: date-time
description: End date of the Entity.
startDateTime:
type: string
format: date-time
description: Start date of the Entity.
title: TimePeriod
In Power BI that's not a datetime string, it is a datetimezone string. Not sure if Power Automate makes the same distinction.