使用 Postman 和 salesforce 的 API 创建发票时出错
Error on creating invoice using APIs from Postman and salesforce
我正在尝试从 Postman 和 Salesforce 以及我遇到错误的两个地方创建发票记录。
对我来说它看起来像是一个语法错误,但找不到它
在 Postman Invoice Create 中,我在正文下方传递:
{
"Line": [
{
"Amount": 100.00,
"DetailType": "SalesItemLineDetail",
"SalesItemLineDetail": {
"ItemRef": {
"value": "1",
"name": "Services"
}
}
}
],
"CustomerRef": {
"value": "58"
}
}
但是我收到这个错误:
{"Fault":{"Error":[{"Message":"Error parsing
query","Detail":"QueryParserError:
null","code":"4000","element":"Query"}],"type":"ValidationFault"},"time":"2021-05-01T09:07:03.252-07:00"}
在 Salesforce 中,我使用以下代码创建发票:
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://sandbox-quickbooks.api.intuit.com/v3/company/462081dsfdsfsfds550/query?minorversion=56');
request.setMethod('POST');
request.setHeader('Accept', 'application/json');
request.setHeader('Content-Type', 'application/text');
request.setHeader('Authorization', authorization);
request.setHeader('Authorization', 'Bearer sessionId');
string body = '{"Line": [{"DetailType": "SalesItemLineDetail","Amount": 100.0,"SalesItemLineDetail": {"ItemRef": {"name": "Services", "value": "1"}}}], "CustomerRef": {"value": "58"}}';
request.setBody(body);
HttpResponse response = http.send(request);
我遇到以下错误:
{"Fault":{"Error":[{"Message":"Error parsing query","Detail":"QueryParserError: Invalid content. Lexical error at line 1, column 1. Encountered: \"{\" (123), after : \"\"","code":"4000"}],"type":"ValidationFault"},"time":"2021-05-01T09:10:23.563-07:00"}
对我来说,它看起来像是一些语法错误,但不确定它在哪里
我发现了这个问题,这是因为 URL
我正在使用这个:
https://sandbox-quickbooks.api.intuit.com/v3/company/462081dsfdsfsfds550/query?minorversion=56
而不是
https://sandbox-quickbooks.api.intuit.com/v3/company/462081dsfdsfsfds550/invoice?minorversion=56
我正在尝试从 Postman 和 Salesforce 以及我遇到错误的两个地方创建发票记录。 对我来说它看起来像是一个语法错误,但找不到它
在 Postman Invoice Create 中,我在正文下方传递:
{
"Line": [
{
"Amount": 100.00,
"DetailType": "SalesItemLineDetail",
"SalesItemLineDetail": {
"ItemRef": {
"value": "1",
"name": "Services"
}
}
}
],
"CustomerRef": {
"value": "58"
}
}
但是我收到这个错误:
{"Fault":{"Error":[{"Message":"Error parsing query","Detail":"QueryParserError: null","code":"4000","element":"Query"}],"type":"ValidationFault"},"time":"2021-05-01T09:07:03.252-07:00"}
在 Salesforce 中,我使用以下代码创建发票:
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://sandbox-quickbooks.api.intuit.com/v3/company/462081dsfdsfsfds550/query?minorversion=56');
request.setMethod('POST');
request.setHeader('Accept', 'application/json');
request.setHeader('Content-Type', 'application/text');
request.setHeader('Authorization', authorization);
request.setHeader('Authorization', 'Bearer sessionId');
string body = '{"Line": [{"DetailType": "SalesItemLineDetail","Amount": 100.0,"SalesItemLineDetail": {"ItemRef": {"name": "Services", "value": "1"}}}], "CustomerRef": {"value": "58"}}';
request.setBody(body);
HttpResponse response = http.send(request);
我遇到以下错误:
{"Fault":{"Error":[{"Message":"Error parsing query","Detail":"QueryParserError: Invalid content. Lexical error at line 1, column 1. Encountered: \"{\" (123), after : \"\"","code":"4000"}],"type":"ValidationFault"},"time":"2021-05-01T09:10:23.563-07:00"}
对我来说,它看起来像是一些语法错误,但不确定它在哪里
我发现了这个问题,这是因为 URL 我正在使用这个:
https://sandbox-quickbooks.api.intuit.com/v3/company/462081dsfdsfsfds550/query?minorversion=56
而不是
https://sandbox-quickbooks.api.intuit.com/v3/company/462081dsfdsfsfds550/invoice?minorversion=56