VBA API Sample script that includes input_data

VBA API Sample script that includes input_data

Hi all,

I'm trying to create a VBA script I can run as an excel macro that will create a request ticket with a certain template.

I'm having trouble getting the correct format for input_data, I keep getting following error:

{"response_status":{"status_code":4000,"messages":[{"status_code":4001,"field":"input_data","type":"failed","message":"Value not provided"}],"status":"failed"}}

Relevant code:


Public Sub httpclient()

Dim xmlhttp As New MSXML2.XMLHTTP60, myurl As String, inputData As String

myurl = "##############"

xmlhttp.Open "POST", myurl, False
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "authtoken", "##########"

inputData = "{input_data:{""request"":{" _
    & """subject"":""Onboard Lord Sauron""," _
    & """description"":""Please give Lord Sauron all necessary permissions to forge the ring""," _
    & """requester"":{""id"":1}," _
    & """status"":{" _
    & """name"":""Open""" _
    & "}," _
    & """template"":{""id"":1}," _
    & """technician"":{""id"":1}," _
    & """udf_fields"":{" _
    & """udf_date_1"":{""value"":42609919896000}," _
    & """udf_sline_2"":$name," _
    & """udf_sline_3"":$personalEmail," _
    & """udf_pick_4"":""Sales Exec""" _
    & "}," _
    & """site"":{""id"":1}" _
    & "}}"
 
xmlhttp.send inputData



Any help appreciated, thanks!
 

                  New to ADSelfService Plus?