Mule - Salesforce 连接器 - 检索作业失败结果批量 v2 - 不返回失败数据
Mule - Salesforce connector - Retrieve job failed results bulk v2 - not returning failed data
我正在 Mule 中查询 Salesforce Bulk api 失败的结果。但它不获取数据。它仅显示记录 ID 和错误消息。但是如果我签入 workbench,它会显示 id、错误、datacolumns(a,b,c)
如何获取这些详细信息..是否有任何其他方法可以在 Mule
中获取大量 api v2 失败结果
在记录之前进行简单的转换
%dw 2.0
output application/json
---
payload
调试日志:
在 workbench,我得到了实际数据。
请分享您的想法,为什么我看不到这些数据
@RestResource(urlMapping='/bulkapi/failures')
global without sharing class RestGetBulkAPIResults
{
@HttpGet
global static void getFailedRecords()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
res.addHeader('Content-Type', 'application/json');
Http http = new Http();
HttpRequest httpReq = new HttpRequest();
HttpResponse httpRes = new HttpResponse();
httpReq.setMethod('GET');
httpReq.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
string path = '/services/data/v48.0/jobs/ingest/7502i000001fJG9AAM/failedResults/';
httpReq.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+ path);
httpRes = http.send(httpReq);
string op = httpRes.getBody();
string[] rowList = op.split('\n');
string[] headers = rowList[0].split(',');
integer columnsCount = headers.size();
integer dataRowsCount = rowList.size();
string fullFormattedData = '[';
for(integer rowIndex =1; rowIndex < dataRowsCount; rowIndex++)
{
string[] rowData = rowList[rowIndex].split(',');
string rowJsonData ='{';
for(integer columnIndex=0; columnIndex < columnsCount; columnIndex++)
{
rowJsonData += headers[columnIndex] + ':' + rowData[columnIndex] + ',';
}
rowJsonData = rowJsonData.removeEnd(',');
rowJsonData += '}';
fullFormattedData += rowJsonData;
}
fullFormattedData += ']';
system.debug('resp' + httpRes.getBody());
res.responseBody = Blob.valueOf(fullFormattedData);
res.statusCode = 200;
}
}
我正在 Mule 中查询 Salesforce Bulk api 失败的结果。但它不获取数据。它仅显示记录 ID 和错误消息。但是如果我签入 workbench,它会显示 id、错误、datacolumns(a,b,c) 如何获取这些详细信息..是否有任何其他方法可以在 Mule
中获取大量 api v2 失败结果在记录之前进行简单的转换
%dw 2.0
output application/json
---
payload
调试日志:
在 workbench,我得到了实际数据。
请分享您的想法,为什么我看不到这些数据
@RestResource(urlMapping='/bulkapi/failures')
global without sharing class RestGetBulkAPIResults
{
@HttpGet
global static void getFailedRecords()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
res.addHeader('Content-Type', 'application/json');
Http http = new Http();
HttpRequest httpReq = new HttpRequest();
HttpResponse httpRes = new HttpResponse();
httpReq.setMethod('GET');
httpReq.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
string path = '/services/data/v48.0/jobs/ingest/7502i000001fJG9AAM/failedResults/';
httpReq.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+ path);
httpRes = http.send(httpReq);
string op = httpRes.getBody();
string[] rowList = op.split('\n');
string[] headers = rowList[0].split(',');
integer columnsCount = headers.size();
integer dataRowsCount = rowList.size();
string fullFormattedData = '[';
for(integer rowIndex =1; rowIndex < dataRowsCount; rowIndex++)
{
string[] rowData = rowList[rowIndex].split(',');
string rowJsonData ='{';
for(integer columnIndex=0; columnIndex < columnsCount; columnIndex++)
{
rowJsonData += headers[columnIndex] + ':' + rowData[columnIndex] + ',';
}
rowJsonData = rowJsonData.removeEnd(',');
rowJsonData += '}';
fullFormattedData += rowJsonData;
}
fullFormattedData += ']';
system.debug('resp' + httpRes.getBody());
res.responseBody = Blob.valueOf(fullFormattedData);
res.statusCode = 200;
}
}