Hello, I am trying to create a receipt entry with REST api using EpicorRest Helper. I’m getting a error and I can’t figure out why.
int vendorNum = 156;
int poNum = 544650;
string packSlip = "123";
var ReceiptDS = new Dictionary<string, object>
{
{"ds", new Dictionary<string, object>
{
{"RcvHead", null },
{"RcvHeadAttch", null },
{"RcvHeadTax", null },
{"RcvDtl", null },
{"RcvDtlAttch", null },
{"RcvDtlAttrValueSet", null },
{"RcvDtlTax", null },
{"RcvDuty", null },
{"RcvMisc", null },
{"RcvMiscTax", null },
{"LegalNumGenOpts", null },
{"PendingRcvDtl", null }
}
},
};
var inputData = new Dictionary<string, object>
{
{"ds", ReceiptDS},
{"vendorNum", vendorNum},
{"purPoint", ""},
{"poNum", poNum }
};
var getHead = EpicorRest.BoPost("ERP.BO.ReceiptSvc", "GetNewRcvHeadWithPONum", JsonConvert.SerializeObject(inputData));
//var result = JsonConvert.DeserializeAnonymousType(response, new Dictionary<string, object>());
print("Testing");
if (getHead.IsErrorResponse)
{
//Trigger email
Debug.Print(getHead.ResponseError);
}
else
{
Debug.Print("success");
//var receiptDS = JsonConvert.DeserializeAnonymousType(getHead.ToString(), new Dictionary<string, object>());
var newReceiptDtlDs = new Dictionary<string, object>
{
{"ds", ReceiptDS},
{"vendorNum", vendorNum},
{"purPoint", ""},
{"packSlip", packSlip }
};
var getDtl = EpicorRest.BoPost("ERP.BO.ReciptSvc", "GetNewRcvDtl", JsonConvert.SerializeObject(newReceiptDtlDs));
if (getDtl.IsErrorResponse)
{
Debug.Print(getDtl.ResponseError);
}
else
{
Debug.Print(getDtl.ResponseBody);
Debug.Print("Success");
}
}
and the error I am getting is this:
Testing
success
Unexpected character encountered while parsing value: S. Path '', line 0, position 0.
it’s happening on this line: var getDtl = EpicorRest.BoPost("ERP.BO.ReciptSvc", "GetNewRcvDtl", JsonConvert.SerializeObject(newReceiptDtlDs));