0

How can we override the start_time and end_time in https://www.twilio.com/docs/taskrouter/api/worker/statistics?code-sample=code-retrieve-a-specific-workers-statistics&code-language=Node.js&code-sdk-version=3.x.

I tried to pass the startDate and endDate as below, but in the response the start_time and end_time seems to be unaffected.

var response = await fetch(`https://xxxxxxxxxxxxxxxxx`, {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      method: 'POST',
      body: (
        `workerSid=${manager.workerClient.sid}`
        + `&startDate=${isoYesterdayDate}`
        // + `&endDate=${isoCurrentDate}`
        
      )
    })

Can any one please help me fix this.

An User
  • 221
  • 6
  • 23
  • This doesn't look like a request to the Twilio API to me. There's no authentication and you are passing the `workerSid` as parameter in the body of the request and not the URL. Also, if you are working in Node.js then you could use the [Twilio Node package](https://www.twilio.com/docs/libraries/node) which would make making these requests easier for you. Can you share your actual request to the API? – philnash Apr 19 '21 at 06:13
  • I was only testing wrong. The code actually worked. Thanks – An User Apr 20 '21 at 10:39

0 Answers0