I'm trying to pass the following body to my POST request via httr:
{
"transactionId": "55",
"IncidentNumber": "",
"customerEmailAddress": "pbi_cqd@example.com",
"customerName": "Power BI CQD Notifications",
"customerPhoneNumber": "",
"customerAgency": "Agency",
"customerSiteId": "1234",
"incidentPriority": "3",
"problemSummary": {
"synopsis": "Call Quality Analytics: Issue detected",
"description": "test"
}
}
The request works in Postman.
In R, however, I'm receiving the error "Error: object of type 'closure' is not subsettable". I'm not sure that I'm setting this up correctly, as there is a nested structure to the body:
URL <- paste0(InstanceURL, API_EndPoint)
Problem_summary <- list(
synopsys = "Call Quality Analytics: Issue detected",
description = "test"
)
Full_body <- list(
transactionId = "55",
IncidentNumber = "",
customerEmailAddress = "pbi_cqd@example.com",
customerName = "Power BI CQD Notifications",
customerPhoneNumber = "",
customerAgency = "Agency",
customerSiteId = "1234",
incidentPriority = "3",
problemSummary = Problem_summary
) %>% jsonlite::toJSON(pretty = TRUE)
Incident <- POST(URL, body = Full_body, encode = "json", handle = handle)
Any suggestions? If it helps, this is the ServiceNow REST API to create a new incident.
Thanks in advance!