Skip to main content

Hello, I am trying to to use the web request node in the workflow automator to create a task based on a reader return value. I keep getting an invalid json response though with an empty body in the logs.

 

Has anyone else had issues with the body field on the web request node?

 

URI: https://companyname.freshservice.com/api/v2/tickets/{{ticket.id_numeric}}/tasks

body:

{
  "due_date": "{{ticket.ri_99_cf_date_of_joining}}",
  "notify_before": 0,
  "title": "{{ticket.ri_99_cf_preferred_first_name}} {{ticket.ri_99_cf_last_name}} - {{ticket.ri_99_cf_date_of_joining}}",
  "description": "description",
  "group_id": 185555255026,
  "agent_id": {{R1.office_manager}}
}

 

Thank you!

Hi @jon.mou,

Thank you for attaching the Json format of the task you’re trying to create, Please check the following to ensure a Successful API call:

*)Type of the Call - GET,POST,PUT,DELETE.

*)Endpoint URL - https://companyname.freshservice.com/api/v2/tickets/ticket_id/tasks

*)Authentication Type : Basic Authentication

    —>Username : API Key

    —>Password : Any single letter character eg. ‘X’

*)Mandatory fields in the Body of the Payload.

*)Use the Test App Action before triggering the Web request/Webhook through the Workflow.

*)Can you add a Note in the Ticket and check if all the fields are being printed in the Note and check the format of it and trigger a call using Workflow or Postman?

*)Create a test Task and do a GET call on it, Copy the Payload and replicate it in the Web request Node. eg.

_bAWCJzjTLKYOlkVPPUDa8jExFQw6IpHJGWizNPfSGjYx2fXRRjOJU9-2M64a3LsKqoj9AhHxGhP01NRuCobi5dMGrbLlisdYkrv1oMxDTSACaAXx9PGTi45re8dsztU7yJ77mg9

Attaching the basic sample Payload. 

{

    "due_date": "2022-03-30T21:00:00Z",

    "notify_before": 0,

    "title": "Test Task - 1",

    "description": "Hello there - 1"

}

Hope this helps!


Hey @Ammar KB , 

 

Thank you fro the response. I am trying to create in this case so I am using POST. The exact call (minus the placeholders) works within postman but not in freshservice. I believe there is some type of formatting error with the placeholders themselves but I am not sure where. 


@jon.mou 

No simpler way to troubleshoot than stripping it down and building it back up.  I would suggest replacing the placeholders with hardcoded values, then one by one replacing them back with their original placeholders.

My initial look at your code shows some values in quotes where maybe should not be quotes.  Look at the date, by putting the placeholder in quotes are you passing that value as text instead of the variable; while the agent ID has no quotes.

 


@jon.mou Gotta agree with @patricksawyer. I would be curious to see what data type the reader node is giving you for the agent {{R1.office_manager}}. If you find you are having issues with the data, you could try applying some liquid filters to get the right format. Here is some information regarding the liquid language https://shopify.github.io/liquid/.


@zachary.king @patricksawyer 

 

I was able to mess around with the data types using liquid filters and was able to get everything resolved except for the “agent_id”.  {{R1.office_manager}} returns an integer number which according to the documentation is correct but it looks like using the Create a Task API call doesn’t allow you to set “agent_id”.

 

https://api.freshservice.com/#create_ticket_task

 

 


@jon.mou According to API documentation it looks as if the agent_id field is part of the payload and is a field that should be allowed as part of your POST request.

If you are finding that it won’t allow you to pass in that value, even through postman, then I would reach out to support@freshservice.com to have it addressed. You can also take this issue over to the developer community where they can verify the documentation for the Freshservice API. Hope this helps.


Agents assigned to tasks are considered task Owners. So the API POST payload for task creation would require you to pass the agent ID as below:

 

{
  "due_date": "{{ticket.ri_99_cf_date_of_joining}}",
  "notify_before": 0,
  "title": "{{ticket.ri_99_cf_preferred_first_name}} {{ticket.ri_99_cf_last_name}} - {{ticket.ri_99_cf_date_of_joining}}",
  "description": "description",
  "group_id": 185555255026,
  "owner_id": {{R1.office_manager}}
}

 

The same logic would apply for release ticket creation via API.

 

We will have our internal teams update the API documentation accordingly. Thank you.


@zachary.king @patricksawyer 

 

I was able to mess around with the data types using liquid filters and was able to get everything resolved except for the “agent_id”.  {{R1.office_manager}} returns an integer number which according to the documentation is correct but it looks like using the Create a Task API call doesn’t allow you to set “agent_id”.

 

https://api.freshservice.com/#create_ticket_task

 

 

@jon.mou  - can you provide which liquid filters you used?  I’m having the same trouble and nothing I’ve tried is working.  Thanks!


Reply