Trouble Running Report Via Rest - Any Pointers?

Below I will post the input parameter for the SERVER/api/v1/Erp.RPT.PackingSlipPrintSvc/RunDirect method and then what I am passing… If anyone has any idea why it doesn’t run please let me know.

I tried to follow @Mark_Wonsil 's post here: Running Reports from REST - #3 by bradberkobien

Here is the parameter the run direct method is looking for

{
  "ds": {
    "PackingSlipParam": [
      {
        "PackNum": 0,
        "PrintingOptions": "string",
        "AssignLegalNumber": true,
        "EnableAssignLegalNumber": true,
        "DCHdrList": "string",
        "PackNumList": "string",
        "StyleNumExt": 0,
        "EnableIncludePCID": true,
        "IncludePCID": true,
        "DocCopyNum": "string",
        "DraftMode": true,
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "AutoAction": "string",
        "PrinterName": "string",
        "AgentSchedNum": "0",
        "AgentID": "string",
        "AgentTaskNum": 0,
        "RecurringTask": true,
        "RptPageSettings": "string",
        "RptPrinterSettings": "string",
        "RptVersion": "string",
        "ReportStyleNum": 0,
        "WorkstationID": "string",
        "TaskNote": "string",
        "ArchiveCode": 0,
        "DateFormat": "string",
        "NumericFormat": "string",
        "AgentCompareString": "string",
        "ProcessID": "string",
        "ProcessCompany": "string",
        "ProcessSystemCode": "string",
        "ProcessTaskNum": 0,
        "DecimalsGeneral": 0,
        "DecimalsCost": 0,
        "DecimalsPrice": 0,
        "GlbDecimalsGeneral": 0,
        "GlbDecimalsCost": 0,
        "GlbDecimalsPrice": 0,
        "FaxSubject": "string",
        "FaxTo": "string",
        "FaxNumber": "string",
        "EMailTo": "string",
        "EMailCC": "string",
        "EMailBCC": "string",
        "EMailBody": "string",
        "AttachmentType": "string",
        "ReportCurrencyCode": "string",
        "ReportCultureCode": "string",
        "SSRSRenderFormat": "string",
        "UIXml": "string",
        "PrintReportParameters": true,
        "SSRSEnableRouting": true,
        "DesignMode": true,
        "RowMod": "string"
      }
    ],
    "ReportStyle": [
      {
        "Company": "GRC",
        "ReportID": "string",
        "StyleNum": 0,
        "StyleDescription": "string",
        "RptTypeID": "string",
        "PrintProgram": "string",
        "PrintProgramOptions": "string",
        "RptDefID": "string",
        "CompanyList": "string",
        "ServerNum": 0,
        "OutputLocation": "string",
        "OutputEDI": "string",
        "SystemFlag": true,
        "CGCCode": "string",
        "SysRevID": "0",
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "RptCriteriaSetID": "string",
        "RptStructuredOutputDefID": "string",
        "StructuredOutputEnabled": true,
        "RequireSubmissionID": true,
        "AllowResetAfterSubmit": true,
        "HasBAQOrEI": true,
        "BitFlag": 0,
        "ReportRptDescription": "string",
        "RptDefRptDescription": "string",
        "RptTypeRptTypeDescription": "string",
        "RowMod": "string"
      }
    ],
    "ExtensionTables": [
      {
        "Table": [
          {
            "ColumnValues": [
              {}
            ],
            "RowMod": "string",
            "SysRowID": "00000000-0000-0000-0000-000000000000"
          }
        ],
        "SystemCode": "string",
        "TableName": "string",
        "Columns": [
          {
            "ColumnName": "string",
            "ColumnType": "string"
          }
        ],
        "PrimaryKeyColumns": [
          "string"
        ],
        "PeerTableSystemCode": "string",
        "PeerTableName": "string"
      }
    ]
  }
}

This is what I am supplying, but I get an error: 400 Sorry! Something went wrong. Please contact your system administrator.

My Parameter

{
  "ds": {
    "PackingSlipParam": [
      {
        "PackNum": 0,
        "PrintingOptions": "S",
        "AssignLegalNumber": false,
        "EnableAssignLegalNumber": false,
        "DCHdrList": "",
        "PackNumList": "145107",
        "StyleNumExt": 1003,
        "EnableIncludePCID": false,
        "IncludePCID": false,
        "DocCopyNum": "",
        "DraftMode": false,
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "AutoAction": "SSRSPREVIEW",
        "PrinterName": "",
        "AgentSchedNum": "0",
        "AgentID": "SystemTaskAgent",
        "AgentTaskNum": 0,
        "RecurringTask": false,
        "RptPageSettings": "",
        "RptPrinterSettings": "",
        "RptVersion": "",
        "ReportStyleNum": 1005,
        "WorkstationID": "1111111",
        "TaskNote": "",
        "ArchiveCode": 0,
        "DateFormat": "m/d/yyyy",
        "NumericFormat": ",.",
        "AgentCompareString": "",
        "ProcessID": "",
        "ProcessCompany": "",
        "ProcessSystemCode": "",
        "ProcessTaskNum": 0,
        "DecimalsGeneral": 0,
        "DecimalsCost": 0,
        "DecimalsPrice": 0,
        "GlbDecimalsGeneral": 0,
        "GlbDecimalsCost": 0,
        "GlbDecimalsPrice": 0,
        "FaxSubject": "",
        "FaxTo": "",
        "FaxNumber": "",
        "EMailTo": "",
        "EMailCC": "",
        "EMailBCC": "",
        "EMailBody": "",
        "AttachmentType": "",
        "ReportCurrencyCode": "USD",
        "ReportCultureCode": "en-US",
        "SSRSRenderFormat": "PDF",
        "UIXml": "",
        "PrintReportParameters": false,
        "SSRSEnableRouting": false,
        "DesignMode": false,
        "RowMod": "A"
      }
    ],
    "ReportStyle": [
      {
        "Company": "GRC",
        "ReportID": "PackSlip",
        "StyleNum": 1005,
        "StyleDescription": "Standard - SSRS - Copy",
        "RptTypeID": "SSRS",
        "PrintProgram": "Reports/CustomReports/GRC-PackingSlip/PackSlip4X6",
        "PrintProgramOptions": "",
        "RptDefID": "PackSlipGRC",
        "CompanyList": "",
        "ServerNum": 0,
        "OutputLocation": "Database",
        "OutputEDI": "",
        "SystemFlag": false,
        "CGCCode": "",
        "SysRevID": "0",
        "SysRowID": "00000000-0000-0000-0000-000000000000",
        "RptCriteriaSetID": "null",
        "RptStructuredOutputDefID": "null",
        "StructuredOutputEnabled": false,
        "RequireSubmissionID": false,
        "AllowResetAfterSubmit": false,
        "HasBAQOrEI": false,
        "BitFlag": 0,
        "ReportRptDescription": "",
        "RptDefRptDescription": "",
        "RptTypeRptTypeDescription": "",
        "RowMod": ""
      }
    ],
    "ExtensionTables": [
      {
        "Table": [
          {
            "ColumnValues": [
              {}
            ],
            "RowMod": "",
            "SysRowID": "00000000-0000-0000-0000-000000000000"
          }
        ],
        "SystemCode": "",
        "TableName": "",
        "Columns": [
          {
            "ColumnName": "",
            "ColumnType": ""
          }
        ],
        "PrimaryKeyColumns": [
          ""
        ],
        "PeerTableSystemCode": "",
        "PeerTableName": ""
      }
    ]
  }
}

Two quick thoughts: I got rid of the extension tables and I used the actual SysRowID for the Report Style (available in the trace or you can get it in a BAQ).

{
	"ds": {
		"PackingSlipParam": [{
			"PackNum": 0,
			"PrintingOptions": "S",
			"AssignLegalNumber": false,
			"EnableAssignLegalNumber": false,
			"DCHdrList": "",
			"PackNumList": "145107",
			"StyleNumExt": 1003,
			"EnableIncludePCID": false,
			"IncludePCID": false,
			"DocCopyNum": "",
			"DraftMode": false,
			"SysRowID": "00000000-0000-0000-0000-000000000000",
			"AutoAction": "SSRSPREVIEW",
			"PrinterName": "",
			"AgentSchedNum": "0",
			"AgentID": "SystemTaskAgent",
			"AgentTaskNum": 0,
			"RecurringTask": false,
			"RptPageSettings": "",
			"RptPrinterSettings": "",
			"RptVersion": "",
			"ReportStyleNum": 1005,
			"WorkstationID": "1111111",
			"TaskNote": "",
			"ArchiveCode": 0,
			"DateFormat": "m/d/yyyy",
			"NumericFormat": ",.",
			"AgentCompareString": "",
			"ProcessID": "",
			"ProcessCompany": "",
			"ProcessSystemCode": "",
			"ProcessTaskNum": 0,
			"DecimalsGeneral": 0,
			"DecimalsCost": 0,
			"DecimalsPrice": 0,
			"GlbDecimalsGeneral": 0,
			"GlbDecimalsCost": 0,
			"GlbDecimalsPrice": 0,
			"FaxSubject": "",
			"FaxTo": "",
			"FaxNumber": "",
			"EMailTo": "",
			"EMailCC": "",
			"EMailBCC": "",
			"EMailBody": "",
			"AttachmentType": "",
			"ReportCurrencyCode": "USD",
			"ReportCultureCode": "en-US",
			"SSRSRenderFormat": "PDF",
			"UIXml": "",
			"PrintReportParameters": false,
			"SSRSEnableRouting": false,
			"DesignMode": false,
			"RowMod": "A"
		}],
		"ReportStyle": [{
			"Company": "GRC",
			"ReportID": "PackSlip",
			"StyleNum": 1005,
			"StyleDescription": "Standard - SSRS - Copy",
			"RptTypeID": "SSRS",
			"PrintProgram": "Reports/CustomReports/GRC-PackingSlip/PackSlip4X6",
			"PrintProgramOptions": "",
			"RptDefID": "PackSlipGRC",
			"CompanyList": "",
			"ServerNum": 0,
			"OutputLocation": "Database",
			"OutputEDI": "",
			"SystemFlag": false,
			"CGCCode": "",
			"SysRevID": "0",
			"SysRowID": "00000000-0000-0000-0000-000000000000",
			"RptCriteriaSetID": "null",
			"RptStructuredOutputDefID": "null",
			"StructuredOutputEnabled": false,
			"RequireSubmissionID": false,
			"AllowResetAfterSubmit": false,
			"HasBAQOrEI": false,
			"BitFlag": 0,
			"ReportRptDescription": "",
			"RptDefRptDescription": "",
			"RptTypeRptTypeDescription": "",
			"RowMod": ""
		}]
	}
}

I just tried that and had no luck :frowning:

Are you running this from the Swagger page?

Yeah.

What is even stranger @Mark_Wonsil is that I can run the /GetDefaults method which takes the SAME EXACT input parameter and it returns with a 200 - OK when I pass it the input parameter I posted above (with the changes you suggested).

Found this in event viewer. Ice.Common.HostException: Application server URL in the System Agent is not specified. It is required for REST calls.

Is the System Agent running? Is this your Live or Pilot?

You can still run the command within Epicor?

I don’t think it’s an issue with your parameter…but what… :thinking:

Any clues in the Server log? Flight Data Recorder?

Yeah it is running, I can run the report within epicor if that is what you mean…

Yep, that’s it. I had that too. Go to your System Agent and you’ll see it there on the first page. Fill it in and see what happens.

1 Like

Just turned on server log… will report back.

I see it in the history of tasks but it never previews…

That helped get it to the task agent but not getting a preview now.

This is different than when I print it from within Epicor.

image

Run direct v.s Submit to agent maybe.

I assume it’s got nowhere to send the report since your rest application does not have a system monitor to intercept the reports. If you have email set up, try sending via email using AutoAction=“SSRSPRINT”, AttachmentType=“PDF”, and EmailTo=“your email address”

1 Like

Interesting point @tanner … I thought since I was supplying the workstation ID then it would print there…

It did send to my email. I guess I will need to figure out how to print preview something.

Do you know how to send it to a printer? That’s my next task.

I’ll close this thread because I really needed to add the app server url to the system agent like @Mark_Wonsil said. I will start a new thread on how to print preview/send to printer.

As long as you set up a server side printer I believe you would just define the path to the printer instead of the email address info. Tracing it through the client should show you the parameter values. Hope that helps!

I’m tracing it, but it is a client printer. Unfortunately I don’t know how to pass the Page settings and what not because they are using special characters which is causing the post to fail.