I tried two versions of the call with a part number that had “/” in it. Ex: 1234-1/4
Both of the below options fails. Am I missing something in the way it’s written?
// Option 1 - returns a list of all parts
MultiMap<string, string> parameters = new MultiMap<string, string>();
parameters.Add("PartNum", partNum);
var response = EpicorRest.BoGet("Erp.BO.PartSvc",$"GetById", parameters);
// Options 2 - returns 400 Bad Request
var response = EpicorRest.BoGet("Erp.BO.PartSvc", $"Parts('{Company ID}','{partNum}')");
There may be other problems besides slashes then. I would recommend using one of the built in options C# has for URL encoding a string on the part number before using it.
As Josh said we can’t encode it for you because only a portion of that parameter should be encoded I would recommend though instead of doing a replace that you use HttpEncoding library as shown
string companyID="MfgSys";
string myCrazyPartNumber="My/Parts/Are/Crazy/Long/And/Have/Slashes/In/Them";
var response = EpicorRest.BoGet("Erp.BO.PartSvc", $"Parts('{companyID}','{System.Web.HttpUtility.UrlEncode(myCrazyPartNumber)}')");