Elliott API (JSON Web Service)


Prerequisites:

Features that require PSQL v13 or later

Pagination


Elliott API supports paging. In some API routes such as the /order/search, the API could return potentially large result set. To enhance performance, you can specify a combination of PageNumber and PageSize in the request to page through the result.  The new pagination feature relies on the new LIMIT and OFFSET sql syntax that only become available with the PSQL v13 release. If you are running PSQL server version < 13, you will get an error if you attempt to use the paging feature. 

Example: 
If there are 1000 items in the results, to get the 101-200 items you can specify PageNumber=2, PageSize = 100.

Note:
If you are running PSQL v12, you can still limit the result set by specifying PageNumber = 1 and PageSize = N to retrieve the first N items. In this special case, the the API will use the TOP command instead.

From ElliottApi documentation (included in swagger):
PageNumberinteger($int32)
Specify page number. Default is 1. PageNumber starts at 1.
PageSizeinteger($int32)
Specify page size. Default is 100.

From PSQL v13 release notes, the LIMIT and OFFSET syntax only become available with the v13 release:
  PSQL v13 extends its support for SQL with the following new features:
 As an alternative to TOP, LIMIT… OFFSET… syntax is now supported to extract a set of rows from
a query result  

SOAP to JSON Equivalents

Service

SOAP Method

Option

JSON Route

Changes

CustomerInquiry

Customer Resource

GetCustomerInfo

/Customer/get

GetARCodes

GetARSLMFIL

/ElliottQuery/executeQuery

GetARCUSTYP

/ElliottQuery/executeQuery

GetSTATEFIL

/ElliottQuery/executeQuery

GetSHIPVIA

/Customer/shipViaCodes/get

GetTerms

/Customer/termsCodes/get

GetTax

/Customer/taxCodes/get

SearchCustomer

/Customer/search

Order by restricted to CUS_NO and CUS_SEARCH_NAME.  Numeric search fields that supported operators such as > or < should be processed using the AdditionalWhere parameter. The DetailLevel parameter is now supported through the ResultColumns parameter.

FFLNearYou

FFLNearYou Resource

Find FFL

/FFLNearYou/get

Byte stream array of link images not supported at this time.

InvoiceInquiry

Invoice Resource

GetInvHdrByCusNo

/Invoice/search

Order by restricted to INV_NO, INV_CUSTOMER_NO,  INV_ORDER_NO, INV_DATE.

GetOneInvoiceDetail

/Invoice/get

ItemInquiry

GetIMCodes

Item Resource

GetProductCategories

/Item/productCategories/get

GetUserDefinedCodes

/ElliottQuery/executeQuery

GetMatCstTypes

/ElliottQuery/executeQuery

GetBuyerCodes

/Item/buyerCodes/get

GetDistinctValues

Not Supported

SearchItem

/Item/search

Order by restricted to ITEM_NO and ITEM_DESC_SEARCH. The DetailLevel parameter is now supported through the ResultColumns parameter. The customerNo parameter is not supported at this time.

SearchItemMultipleLocation

/Item/search

Quantities from multiple locations not supported at this time.

GetItemAttrib

/Item/attributes/get

GetItemNote

/Item/notes/get

GetItemSetup

/ElliottQuery/executeQuery

GetAllMatCstType

/ElliottQuery/executeQuery

GetAllPrdCat

/Item/productCategories/get

GetOnePrdCat

/ElliottQuery/executeQuery

GetAllBuyerCode

/Item/buyerCodes/get

GetItemDistinctValue

Not Supported

GetOneItemDetail

/Item/get

customerNo

Not supported at this time

attribWebFlag

/Item/attributes/get

noteWebFlag

/Item/notes/get

imageLinkType

/Item/links/get

Byte stream array of link images not supported at this time.

additionalLinkType

/Item/links/get

Not supported at this time

GetFeatureOption

/Item/featureOption/get

GetInvoiceHistory

/Item/searchItemInvoice

Order by option not supported at this time.

OrderInquiry

Order Resource

GetOrder

/Order/search

Order by restricted to ORDER_NO and ORDER_CUSTOMER_NO

GetOneOrderDetail

/Order/get

ResellerFinder

ResellerFinder Resource

FindReseller

/ResellerFinder/get

Order by option not supported at this time.

Vendor

Vendor Resource

GetAllVendor

/Vendor/search

Order by restricted to VEND_NO and VEND_SEARCH_NAME

Logging Configuration

Elliott API uses aspnetcore + nlog for logging. The configuration can be configured with the nlog.config. There are two main sections targets and rules. 

Targets 

Targets specify the destination log entries will be written to.

Exampe - the following entry is the default target for database trace.

    <target name="databaestracefile" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
      <target
        xsi:type="File"
        layout="${longdate} ${message}"
        fileName="logs/database/database.txt"
        archiveFileName="logs/database/database.{#####}.txt"
        archiveAboveSize="10240000"
        archiveNumbering="Sequence"
        maxArchiveFiles="10"
        concurrentWrites="true"
        keepFileOpen="false" />
    </target>

  • type - specify the type of the target, in this example, log entries will be written to a file. You can also specify other targets such as email or to network. For more information, you can look up nlog documentation.
  • fileName -  specify the file to write log entries to. You can use absolute path, or relative path. Relative path is relative to the path of the Elliott API root folder
  • archiveFileName - specify the fileName to use when the log file is archived
  • archiveAboveSize - specify the size the log file will be archived
  • archiveNumbering - specify how archive file will be named.
  • maxArchiveFiles - specify the number of archive files to keep. 

Rules

Rules specify the what will be logged, and where it will be logged.

Example:- following entry will log all log entries output by any classes in "ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware" to the apitracetarget. 

 <logger enabled="true" name="ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.*" level="Trace" writeTo="apitracefile" final="true" />  

  • enabled - specify whether this rule is enabled
  • name - specify the logger name. The logger names are usually the fully qualified namespace + class name in the Elliott API. You can append the "*" wildcard character at the end of a namespace to include all logger in a related namespace.
  • level - specify the level of logging that will be included
  • writeTo - the target to write to
  • final - if true, it will stop matching on further rule

Common Configuration 

Elliott API is distributed with a set of common rules that provide extensive logging that's intended to provide detail logging when it's first setup. Prior to going to production, you may choose to adjust the loggers to only log errors and re-enable detail logging when you need to troubleshoot problems. The following are the default loggers, at the minimum, you will want to enable the logger than writes to "errorfile" (bolded in the example below).

    <logger enabled="true" name="ElliottApi.Infrastructure.Data.*" level="Trace" writeTo="databaestracefile" final="true" />
    <logger enabled="true" name="ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.*" level="Trace" writeTo="apitracefile" final="true" />
    <logger enabled="true" name="ElliottApi.Infrastructure.Providers.Nmi.*" level="Trace" writeTo="nmitracefile" final="true" />
    <logger enabled="true" name="*" minlevel="Error" writeTo="errorfile" />
    <logger enabled="true" name="*" minlevel="Trace" writeTo="logfile" />  

API Logging Configuration

The default rule logs all API raw requests responses to the apitracefile target. 

<logger enabled="true" name="ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.*" level="Trace" writeTo="apitracefile" final="true" />  

The "name" follows this pattern " ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.{route-where-slash-is-replaced-by-dash}". You can use it to target a specific API. For example, if you are only interested in the log messages for "order/search" route. You can have the following rule entry:

  <logger enabled="true" name="ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.order-search*" level="Trace" writeTo="apitracefile" final="true" />    

You can also target multiple routes by having multiple entries that target different routes. For example, to target "order/search" and "vendor/search" routes:

  <logger enabled="true" name="ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.order-search*" level="Trace" writeTo="apitracefile" final="true" />     

  <logger enabled="true" name="ElliottApi.Infrastructure.Owin.ApiLoggingMiddleware.vendor-search*" level="Trace" writeTo="apitracefile" final="true" />     


Troubleshooting: 

If you get System.MissingMethodException after you install the ElliottApi, please check and make sure .NET 4.61 is installed on the hosting machine.
Application: ElliottApi.Web.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.MissingMethodException
Stack:
  at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
  at ElliottApi.Web.Program.Main(System.String[])

If you receive an error stating "[Exception]:[Character literal must contain exactly one" after providing a where condition for a string/character field in an AdditionalWhere parameter, this can be addressed by using single quotes around the condition and double quotes around the value. For example, the following AdditionalWhere parameter used in the /Vendor/search method will generate an error.

{
  "AdditionalWhere": "VEND_ST = 'OH'",
  "PageNumber": 1,
  "PageSize": 10
}

If it is revised to the following statement, the error is resolved.

{
  "AdditionalWhere": 'VEND_ST = "OH"',
  "PageNumber": 1,
  "PageSize": 10
}

VYC, CLS
Created 2019-08-21
Updated 2019-09-10

Developer Documentations

  1. Received Code 9999 with Web Services Call
  2. Received Return Status Code 3 When Using Elilogin Login Method
  3. Elliott Web Service Requirements
  4. Elliott eStore Checklist
  5. LN API
  6. FN API
  7. RN API
  8. IN and DF API Change (V9.0)
  9. FA API Changes (V9.0)
  10. VA API Changes (V9.0)
  11. CartService
  12. EliarachService
  13. ElicshtxService
  14. EliattrbService
  15. ElisyscdService
  16. EliNoteService
  17. El2rstimService
  18. EliOrderService
  19. ItemInquiry
  20. EliitmiqService
  21. EliShiptoService
  22. El2getfrService
  23. Steps Required to Test ReportWriter in V8.2
  24. Installation of ElliottService, NETcellent’s Web Services for Elliott
  25. ResellerFinder
  26. EliaptrxService
  27. VendorInquiry
  28. EliloginService
  29. ElislsmnService
  30. EliserhsService
  31. EliatpobService
  32. ElievprcService
  33. ElihdtrxService
  34. ElicuswlService
  35. QueryTurnaround
  36. InvoiceInquiry
  37. ElicustmService
  38. EligetcdService
  39. OrderInquiry
  40. EliordiqService
  41. EliecontService
  42. EliautdpService
  43. El2CrCrdService
  44. Log-Timer / ElliottTimer.Ini Support
  45. Alpha Document Number Support (V8.5/V9.0)
  46. ElliottService System.TypeInitializationException
  47. Feature - Printing API to Dynamically Set Number of Copies
  48. The Values and Meanings of Distribution Types - ARDISFIL, APDISFIL, IMDISFIL, BMDISFIL
  49. DD API Changes (V9.0)
  50. PA API (8.5)
  51. Validate License API
  52. AP API
  53. TP API: Temporary Path
  54. Data Structures for Report Desk Defaults and Enforcements
  55. COBOL to VB Interface Programs
  56. IN API: Option to Support Files and Folders Validation
  57. FF API: File Functions
  58. ID API
  59. LK: Links API
  60. FFLNearYou
  61. Report Desk Developing and Debugging
  62. Developing a New Elliott V8.6 Report Desk User Defined Report (UDR)
  63. CustomerInquiry
  64. Elliott API (JSON Web Service)
  65. Animating COBOL Code in Elliott V8.5
  66. Preliminary Programming Changes for Elliott 8.6
  67. CV API
  68. System Lock File Requirements
  69. How to Write Test Codes for C# ESS Projects
  70. Solving the Inability to Debug Elliott on a New Server
  71. Report Desk: Developing Custom Reports
  72. Report Desk Tables
  73. Report Desk Database Delivery Strategy

Feedback and Knowledge Base