I am new to Python and have been trying to resolve this. There is an AWS lambda function written in Python which calls a REST point like this:
requests.post(Url,headers=Headers,data=Payload)
Payload in the above call is being passed like this:
Payload='[{"Code": "'+someCode+'","version": "v1","itemNumber": 1,"referenceId": "'+referenceId+'","alertBody": {"customerId": "'+customerId+'"},"Context":{"Id":"'+str(payload['body']['State']['Id'])+'","Name":"Payment","Expiration":0,"Action":"","sourceTimestamp":"'+ str(int(currentTime.timestamp()))+'","sourceApp":"someApp"}}]'
However, due to a recent change in the schema at the API end where we post this Payload to, It has stopped working. The API is now expecting the "sourceTimestamp":"'+ str(int(currentTime.timestamp()))+'" field to be sent as an Integer and not String (currently it is being sent as String as shown in the payload above)
Can someone please guide me how to fix it and send the timestamp filed as an integer and not string? I want adhere to the payload format as above.
Json integers must be given without double quoting them. So simply removing the double quotes arround str(int(currentTime.timestamp()))
would work for your case