Troubleshooting Webhooks

How do I handle backslashes in my JSON data?

When creating an Action associated with a webhook, if you have blackslashes in your JSON data values, they need to be double-escaped.

For example, your data may look like this:

{ "devicename": "ABC-P12345", "Console User": "ABC-P12345\SmithF", "Device Manufacturer": "LENOVO", "Device Model": "XYX", "Device Asset Tag": "No Asset Information", "Battery Manufacturer": "LGC", "Battery Name": "12586ZZ", "Battery Full Capacity Percentage": "101", "Battery Count": "1", "Category": "excellent"}

The \SmithF needs to be double escaped in order for it to be actioned successfully.

The double-escaping for this example is show below in the Value field:

Field

Value

Variable Type

Variable

Name

WebhookBodyC

Data Type

JSON

Value

$(Replace(Variable(“WebhookBody”),”\\”, “\\\\”))

What if I my third party product doesn't handle underscores in Authorization headers?

If you want to use, for example, Azure DevOps, with ITSM webhooks, there is an alternative format of REST API key that you can use in your authorisation header.

1.Create a new request in the Postman application.

2.Enter the following information in the Header tab:

Select the Authorization check box.

Enter the Reference ID (REST API Key) generated for the tenant in the Value column in the format - rest_api_key={Reference ID} OR api-key {Reference ID}.

3.In the same endpoint request window, enter the endpoint request payload details and click the Send button or press the ENTER key.

For more information, see: Using the REST API Key