Automated Push time event using Postman

83 Views Asked by At

I tried using Postman with the payload provided by Oracle, which was successfully uploaded. However, when I attempted to attach these CSV and JSON files in the body as form-data, I was unable to load them in Postman.

I also saved the above files in my Postman directory location.

How can I load bulk data through a file while scheduling the API?

Rest API: /hcmRestApi/resources/11.13.18.05/timeEventRequests

Payload:

{
         "requestNumber": "{{Id}}",
         "sourceId": "HQ-Office",
         "requestTimestamp": "{{currentTimestamp}}",
         "timeEvents": [
            {
               "eventDateTime": "{{EventTime}}",
               "supplierDeviceEvent": "{{Location}}",
               "reporterId": "{{CardHolderId}}",
               "reporterIdType": "PERSON",
               "timeEventAttributes": [
                  {
                     "name": "PayrollTimeType",
                     "value": "Regular Shift Hours"
                  }
               ]
            }
         ]
}

CSV File:

Id,CardHolderId,EventTime,Location
456eer678qwertabc123,3370,2023-05-29T19:20:00.000+00:00,HQ-Office TURNSTILE 1 (IN)
456eer678qwertabc124,3370,2023-05-29T21:20:00.000+00:00,HQ-Office TURNSTILE 3 (OUT)
456eer678qwertabc125,3370,2023-05-29T22:00:00.000+00:00,HQ-Office TURNSTILE 2 (IN)
456eer678qwertabc126,3370,2023-05-30T00:57:00.000+00:00,HQ-Office TURNSTILE 2 (OUT)

I want to add file in form data along with payload so that when file got replaced with same name in the directory location then automatically postman will pick and load data

I am trying to make automated with scheduling collection for every week.

1

There are 1 best solutions below

4
Danny Dainton On

I don't know that API (I think it's this one - https://docs.oracle.com/en/cloud/saas/human-resources/23b/farws/op-timeeventrequests-post.html) but it looks more like it should be a JSON payload and should be placed in Body > raw > JSON - It contains Postman variables {{...}} that are resolved by the values in the CSV file.

enter image description here

The currentTimestamp is missing from the CSV file though so you would need to handle that, depending on the format {{$timestamp}} or {{$isoTimestamp}} might work.

When in the Scheduled Run setup, you can use the Data file option to select the CSV file from your local file explorer before creating the job.

enter image description here