I’m using the Rest API to update our UD05 table and in most cases, it works just fine. The UD05 table is being used to hold our part Compliance information for each Qualified Manufacturer. The Key fields being used are.
Key1 – Part Number
Key2 – Manufacturer (via Manufacturer Number)
Key3 – Manufacturer Part Number
Key4 – Not Used (This causes other issues with Swagger for testing DELETE, but I got around that – I think)
Key5 – Number in Table
The code to POST information seems to be working okay for all part numbers. Deleting information from the table works for all part numbers, except if they have a % character in the Part Number. I don’t like the percentage in the part number, but unfortunately, I have not won that battle yet. I can’t test this out in Swagger (v1) as the UD05-Delete requires information in the Key4 field (which is blank) and 2 single quotes don’t seem to work (‘’) in swagger but do when running it through the Rest call.
For the problem at hand, I believe the issue is with the URL, so I changed the % to %25, but it still fails. I’m not sure what other additional information I can provide, but I take a crack at it,
Sample Json string to Delete.
{
“Company”: “AXIO”,
“Key1”: “100NF-100V-X10%-0603”,
“Key2”: “167”,
“Key3”: “GRM188R72A104KA35D”,
“Key4”: “”,
“Key5”: “1”
}
VBA Code used (condensed version)
pHtml = fn ‘ One of the URLs above
Set httpReq = CreateObject(“Microsoft.XMLHTTP”)
With httpReq
.Open “DELETE”, pHtml, False
.setRequestHeader “Content-Type”, “application/json”
.setRequestHeader “Accept”, “application/json”
.setRequestHeader “Authorization”, "Basic " & Base64Encode(authUser + “:” + authPass)
json = wsRest.Cells(7, 1).Value 'Json string above
.send (json) ‘ Fails here is the part number has a % in it.
End With
I hope I’ve explained this correctly with enough information. I can provide more if needed.
Thanks
Tom