Showing results for 
Search instead for 
Did you mean: 
Walkthrough Wednesdays

415 - Unsupported Media Type Error on Pin Reset

This document was generated from CDN thread

Created by: Andy Melick on 09-11-2011 09:03:48 AM
I am new to REST and I am running into a problem when trying to PUT a request for a pin reset. If I use the same code I have developed with a GET the XML is returned. It seems that I am missing something with the formatting of my PUT request. Any assistance would be greatly appreciated.
 dim XmlHttp
 dim PostURL
 dim ResponseXml
 dim sXML
 sXml="<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"
 sXml=sXml & "<Credential>"
 sXml=sXml & " <EncryptionType>5</EncryptionType><Credentials>44444</Credentials>"
 sXml=sXml & "</Credential>"
 Set XmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
 XmlHttp.Open "PUT", PostUrl, false,  "cupiuser", "*******"
 XmlHttp.SetRequestHeader "Content-Type", "application/xml"
 XmlHttp.SetRequestHeader "Accept", "application/xml"
 XmlHttp.setOption(2) = 13056
 XmlHttp.send sXML
 ResponseXml = XmlHttp.ResponseText
 Response.ContentType = "application/xml"
 response.write responseXML

Subject: RE: 415 - Unsupported Media Type Error on Pin Reset
Replied by: Jeff Lindborg on 05-02-2012 12:59:08 PM
you don't need to pass the EncryptionType there - you are setting a PIN and Connection sets the encryption type to SHA1 on the back end regardless - passing 5 (which means no encryption) is bad mo-jo.
You also need to wrap the request in a "credential" tag.

I just issued a PIN reset to the same URI construction using this as the XML payload:


and it set fine.

You can also pass Locked, CredMustChange, DoesntExpire as additional items to the Credentials string itself...
Content for Community-Ad