Acumatica Rest API获得企业帐户

时间:2018-09-19 15:34:01

标签: c# acumatica

我正试图通过其余的API接收企业帐户信息。我尝试使用过滤器,但不使用过滤器。它使用默认的端点和默认的BusinessAccount。两次运行的结果均在代码后。

我获取Acumatica内容的代码

        public async void GetCustomersActivitiesAsync(int top, string filterOperation, string filter)
    {

        string url = settings.url + settings.endpoint + "BusinessAccount";
        string parametersFilter = "&$filter=BusinessAccount eq  'ABARTENDE'";

        var uri = new Uri(url + parametersFilter);
        try
        {
            var response = await client.GetAsync(uri);
            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();
            }
            else
            {
                err = await response.Content.ReadAsStringAsync();

                try
                {
                    ResponseMessage msg = JsonConvert.DeserializeObject<ResponseMessage>(err);
                    if (msg != null && msg.exceptionMessage != "") err = msg.exceptionMessage;
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                }

            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(@"              ERROR {0}", ex.Message);
            err = ex.Message;
        }
    }

当我运行过滤器时,它会自动失败
当我做一个过滤器时,它返回:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><link href="/A000/Content/font-awesome.css?timestamp=636698449900000000" type="text/css" rel="stylesheet" /><link href="/A000/App_Themes/Default/00_Controls.css?timestamp=636698449900000000" type="text/css" rel="stylesheet" /><title>
	Error Has Occurred
</title><meta http-equiv="content-script-type" content="text/javascript" />
    <style type="text/css">
        .main
        {
            padding-left: 40px;
            padding-right: 20px;
            padding-top: 30px;
            font-family: Arial;
        }
        .errCode
        {
            padding-bottom: 20px;
            font-family: Arial;
            font-size: 15pt;
        }
        .errMsg
        {
            font-size: 12pt;
        }
        .img
        {
            float: left;
            margin-right: 10px;
        }
        .nxtSt
        {
            margin-top: 30px;
            font-family: Arial;
            font-size: 15pt;
        }
        .navTo
        {
            margin-top: 10px;
            margin-left: 20px;
        }
        .errPnl
        {
            padding: 10px;
            padding-top: 15px;
        }
        .grayBox
        {
            border: solid 1px #CCC;
            background-color: #F9F9F9;
            padding-top: 20px;
            padding-bottom: 25px;
            padding-left: 10px;
            padding-right: 20px;
        }
        .traceLnk
        {
            margin-top: 20px;
        }
    </style>
<style type="text/css">
	.frmBottom_CaptionL { background-position:left top;width:5px; }
	.frmBottom_CaptionR { background-position:right top;width:5px; }
	.frmBottom_CaptionM {  }

</style></head>
<body>
    <form name="form1" method="post" action="./Error.aspx" id="form1">
<input type="hidden" name="__RequestVerificationToken" id="__RequestVerificationToken" value="Aq4LEYY5T50IzZfjFHxJWWVP0lq4kLBG-ljIPF3eUYBdBo3UHLHNgHdHF8YW9hpS3nHqiATSFrDybUkJvaXapM_ZItg1" />
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="frmBottom_state" id="frmBottom_state" value="" />
<input type="hidden" name="__SmartPanelVisible" id="__SmartPanelVisible" value="" />
<input type="hidden" name="L10nEditor_state" id="L10nEditor_state" value="" />
<input type="hidden" name="inputBox_state" id="inputBox_state" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="" />


<script type="text/javascript">
//<![CDATA[
var __appPath = '/A000/';var __nodePath="";var __nodeGuid="00000000-0000-0000-0000-000000000000";//]]>
</script>

<script src="/A000/PX.ScriptBatch.axd?d=cFBYLldlYi5VSXxQWC5XZWIuVUkuRXh00&amp;t=636698318120000000" type="text/javascript"></script>
<script src="/A000/PX.ScriptBatch.axd?d=cFBYLldlYi5VSXxQWC5XZWIuVUkuQmFzZQ2&amp;t=636698318120000000" type="text/javascript"></script>
<script src="/A000/PX.ScriptBatch.axd?d=cFBYLldlYi5VSXxQWC5XZWIuVUkuRWRpdA2&amp;t=636698318120000000" type="text/javascript"></script>
<script src="/A000/PX.ScriptBatch.axd?d=cFBYLldlYi5VSXxQWC5XZWIuVUkuR3JpZA2&amp;t=636698318120000000" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var __loadImgUri = "/A000/App_Themes/Default/Images/spinner.gif?imgTimeStamp=636698449900000000";
var __loadStr = "";
var _numbFormatInfo = {negativeSign:"-",currencySymbol:"$",percentSymbol:"%",number:{groupSeparator:",",decimalSeparator:".",groupSizes:[3],negativePattern:1,decimalDigits:2},currency:{groupSeparator:",",decimalSeparator:".",groupSizes:[3],positivePattern:0,negativePattern:0,decimalDigits:2},percent:{groupSeparator:",",decimalSeparator:".",groupSizes:[3],positivePattern:1,negativePattern:1,decimalDigits:2}};
var _dateFormatInfo = {am:"AM",pm:"PM",shortDate:"M/d/yyyy",shortTime:"h:mm tt",longDate:"dddd, MMMM d, yyyy",longTime:"h:mm:ss tt",timeSeparator:":",yearFix:0,monthNames:"January,February,March,April,May,June,July,August,September,October,November,December,",abbrMonthNames:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,",dayNames:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",abbrDayNames:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"};

__createPxContext(window);
var __PXFormView = {maxFileSizeMsg:"The file exceeds the maximal allowed size (25000 KB).",allowedFiles:".als;.cer;.csv;.dat;.doc;.docx;.epl;.exe;.gif;.ico;.ics;.jpeg;.jpg;.js;.mdb;.msi;.ofx;.pdf;.pfx;.ppt;.pptx;.qbo;.qfx;.rar;.rtf;.sql;.swf;.txt;.xls;.xlsx;.xml;.zip;.zpl;.pbix;.png;.svg;.tif;.tiff",allowedFilesMsg:"Only the following file types are allowed: {0}.",callbacks:[{name:"Refresh",repaintControls:1,blockPage:1,postData:0},{name:"Search",repaintControls:1,blockPage:1},{name:"Save",repaintControls:1,blockPage:1,commitChanges:1},{name:"Delete",repaintControls:1,blockPage:1},{name:"AddNew",repaintControls:1,blockPage:1,postData:0},{name:"NoteShow",blockPage:1,postData:0},{name:"NoteSave",repaintControls:3,blockPage:1,postData:0},{name:"FilesMenuShow",blockPage:1,postData:0},{name:"ActivityShow",blockPage:1,postData:0},{name:"LinkShow",repaintControls:3,blockPage:1,postData:0},{name:"LinkUpdate",repaintControls:3,blockPage:1,postData:0},{name:"LinkSend",repaintControls:3,blockPage:1,postData:0},{name:"NotifyMenuShow",repaintControls:3,blockPage:1,postData:0},{name:"NotifyShow",repaintControls:3,blockPage:1,commitChanges:1,postData:0},{name:"CheckActivity",blockPage:1,postData:0},{name:"UploadFile",blockPage:1}],errorCss:"FormError",warningCss:"FormWarn",infoCss:"FormInfo",minHeight:63,filesMenuUrls:{filesDisplayUrl:"~/Frames/GetFile.ashx",fileInfoUrl:"~/Pages/SM/SM202510.aspx"}};
var _frmBottom = {allowCollapse:0,minHeight:0,autoSize:{enabled:1,container:1}};
var _confirmMsg = "Any unsaved changes will be discarded.";
var __PXSmartPanel = {callBackMode:{blockPage:1,postData:0}};
var _L10nEditor = {loadOnDemand:1,autoReload:1,commandName:"SaveLoc",autoCallBack:{behavior:{postData:0}}};
var __PXInputBox = {activeEnter:0,buttonCss:"MessageButton",autoAdjustSize:1,callBackMode:{blockPage:1,postData:0}};
var _inputBox = {};
//]]>
</script>

    <div class="main">
        <div name="frmBottom" id="frmBottom">
		<div style="position:relative;">
			
                <div class="errCode">
                    
                </div>
                <div class="grayBox">
                    <div class="img">
                        <img id="frmBottom_imgMessage" tabindex="100" src="../App_Themes/Default/Images/Message/error2.gif" border="0" />
                    </div>
                    <div class="errMsg">
                        <span id="frmBottom_lblMessage" class="errMsg">We're sorry! An error has occurred while processing your request. A report has been generated for our technical staff to investigate the problem. Please try to repeat your request later. Thank you for understanding.</span>
                    </div>
                </div>
                <div class="traceLnk">
                    <a id="frmBottom_lnkTrace" tabindex="101" href="Trace.aspx"><u><font color="Blue" size="4">Show Trace</font></u></a>
                </div>
                <div class="nxtSt">
                    
                </div>
                <div class="navTo">
                    
                    
                    
                </div>
				
            
		</div>
</div>
    </div>
    <table name="L10nEditor" cellspacing="0" cellpadding="0" id="L10nEditor" tabindex="300" class="SmartPanel" style="display:none;">
	<tr>
		<td id="L10nEditor_cap" class="SmartPanelC" valign="middle"><div class="sprite-icon control-icon" icon="Close" mode="c" style="float:right;">
			<div class="control-icon-img control-Close">
				&nbsp;
			</div>
		</div>Translations</td>
	</tr><tr>
		<td class="SmartPanelCN" id="L10nEditor_cont" width="0" height="0"><div class="panelContent">

		</div></td>
	</tr>
</table><table name="inputBox" cellspacing="0" cellpadding="0" id="inputBox" tabindex="400" class="SmartPanel" width="400" style="display:none;">
	<tr>
		<td id="inputBox_cap" class="SmartPanelC" valign="middle"><div class="sprite-icon control-icon" icon="Close" mode="c" style="float:right;">
			<div class="control-icon-img control-Close">
				&nbsp;
			</div>
		</div>Copy to clipboard (Ctrl+C)</td>
	</tr><tr>
		<td class="SmartPanelCN" id="inputBox_cont" width="400" height="0"><table tabindex="400" border="0" width="100%">
			<tr>
				<td><input name="inputBox$ctl01" type="text" class="editor" /></td>
			</tr><tr>
				<td align="right"><button type="button" class="MessageButton Button">OK</button><button type="button" class="MessageButton Button">Cancel</button></td>
			</tr>
		</table></td>
	</tr>
</table></form>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

查询参数,例如$filter与路径之间用?隔开。在您的情况下,应给出<base url>/BusinessAccount?$filter=<filter espression>