WebAPI
Introduction
This is a general introduction to the System Five Web API Service. It contains information that you need to install and configure the Web API service and the information you need to share with your developer to give them access to your Web API. This service is typically used for 3rd party integrations. It has also been used for Windward Software integrations such as the Data Exchange Portal (DEP) for the Mega Group as well as the Polaris integration.
What is the S5 Web API Service?
The S5 Web API Service is a Windows Service that is installed on your server, right next to your System Five installation. It provides access to your System Five data and functionality through web-based RESTful API calls. Generally the S5 Web API Service is used to facilitate integration between System Five installation and an E-Commerce website of some kind.
Accessing the S5 Web API Service
Once it has been installed and configured the S5 Web API is accessed at the following address*: http://localhost:port#/index.html In the address above, “localhost” should be replaced with the IP address of the machine that the service is installed on, “port#” refers to the “Port” setting in the “S5WebAPISvc_ini” file.
*In order to access the S5 Web API Service from outside of the local machine that it is installed on it may (most likely) be necessary to have your IT department provide outside access through the port specified in the “S5WebAPISvc_ini” file. The configuration of the S5 Web API Service is done through the “S5WebAPISvc_ini” file. This file is located in the same directory that holds the “systemfive.exe” file, and can be read with a text editor.
How Do I Setup an Account for My Developer?
Accessing the S5 Web API Service requires a set of security credentials. These credentials come from System Five and are generally set up by creating a new user in System Five dedicated for use only by the Web API. Generally, this user is setup as “Web API” but you can name it whatever you would like as long as it matches the name set in the “S5WebAPISvc_ini” file. You will be presented with a Login screen. Enter a valid System Five User Name and Password to access the Swagger Documentation Explorer. Once the Swagger Documentation Explorer has loaded, you will need to replace some of the elements in the URI: http://localhost:PORT/Windward/WebAPI/ENDPOINT/Swagger:
- Replace the [LocalHost] with the IP Address or Alias for the Server hosting the API.
- Replace the [PORT] with the value in the Port entry of [HTTP] section of the INI file.
- Replace the [ENDPOINT] with one of the End Names listed along the top of the screen.
Click the [Explore] button to see the Swagger Documentation for the selected End Point.
All of this needs to work correctly before the S5WebAPI Service can be considered operational.
What Information Do I need to Share with My Developer?
Once you have configured an account for your developer you need to tell him or her five pieces of information:
- Developer-facing documentation is the S5webapi Swagger Documentation
- The Server Address is the domain name or IP address of the machine. If you’re not sure of this you should ask your IT people for the exact address. It will either be a domain name like http://www.somserver.com or an IP address like 192.291.19.2.
- The Server Port is the port number that is configured in the “S5WebAPISvc_ini” file for the S5 Web API Service.
- The Username is the username of the account you created. It is also set in the “S5WebAPISvc_ini” file for the S5 Web API Service.
- The final piece is the Password of the account you created. This was created when you created the account for the Web API in System Five.
- Cloud Deployments The Developer/Integrator will need to provide the IP Address that they will be calling the API from, so that it can be White Listed to gain access to the API's features.
Known Developer Integrations
Windward Software Developer Assistance
Included as part of your Web API purchase comes consultation time for your programmer with a Windward Software developer. You can share this email address with your trusted developer: winapisupport@wws5.com. They can use that email address to request support from Windward Software. Note: Once your developer has used this time there may be additional charges for additional support.
Installation
http://wiki.wws5.com/doku.php?id=system_five_web_api_service
Installing Secure WEB API
When installing Secure WEB API, you must be familiar first with regular WEB API installation. Please see this link for more details about WEB API install.
https://docs.google.com/document/d/e/2PACX-1vS3aJApHutaHKtK4ZiDhix-I99RkTn7zplnw6gY0085o6vt5eNNmOA5NdWXTwdfhx5S1JCz_bgZSTu_/pub
Windward Software Systems can help a client install a certificate once it has been purchased. We do not sell SSL certificates, administrate DNS or domain names or change firewall settings. An IT professional can assist in these steps in the process.
Example:
- Windward Software Systems can install our S5webAPI technology on a customer network.
- An IT professional will need to point their hosting providers IP address like x.x.x.x to our installed service.
- An IT professional will need to configure DNS and a domain such as webapi.mybusinessdomain.com to resolve x.x.x.x IP address
- An IT professional will need to purchase an SSL certificate for webapi.mybusinessdomain.com. (We recommend 5 year certificates to avoid business interruption in the event of certificate expirations.)
- Windward Software Systems can assist in the installation of the SSL certificate into the S5WebAPI technology.
Requirements when installing Secure WEB API.
• The client needs to obtain HTTPS certificate files which will be a .pem file and a .crt file. They need to contact their IT guy
• The client will place these files on their server in a folder of their choosing
• The S5WebAPISvc.ini file needs to be updated with the path to the .crt file in the “Cert File” and “Root Cert File” sections
• The S5WebAPISvc.ini file needs to be updated with the path to the .pem file in the “Key File” section
• The S5WebAPISvc.ini file needs to be updated with the HTTPS Port set to something different from the HTTP Port
Configuring the Config file (S5WebAPISvc.ini)
The only difference between the regular WEB API install and Secure WEB API install is the config file. The config file for Secure Web API should look like this.
Secure WEB API config file will have Key File, Root File and Passphrase.
[System Five Web API Service] Service Name=S5WebAPIService
[System Five Database] Directory=E:\S5Beta\WrittenSalesFurnDemo Serial=200000 Department=0 Terminal=1 TerminalName=WebAPI Identifier=WebAPI
[HTTPS] Port=2122 Session Timeout=30 Cert File=C:\System5\bin\TestSSL.pem Key File=C:\System5\bin\TestSSL.pem Root Cert File=C:\System5\bin\TestSSL.pem Passphrase=SSLCertPassphrase
[Swagger Publishing] Enable Swagger Publishing=Y Port=8000 SessionTimeout=30
[Log Analytics] Server Address=127.0.0.1 Server Port=2021
NOTE: HTTPS configurations should not contain any information for the HTTP configuration. The default INI file contains sections for both to assist in the Setup and configuration. Delete the protocol that you are not using!
ADDITIONAL SECTIONS
Swagger Publishing - Section Should be configured for the Integration to any external system. The developer of that system will need to use the Swagger to understand how to call our API.
Log Analytics - Section This needs to be configured to allow the API to send information to Log Analytics via the Windward Connect Service. The Windward Connect Service also requires setup and configuration for this section to have any meaning or affect.
Troubleshooting
Common Issues
- Check INI file settings are aligned with documentation.
- Check service user or group privileges have access to the data files.
- S5WebAPI can be configured to a port that may already be in use by other services
- Port 443 or 80 which Microsoft IIS uses is an example. Pick a port that is available.
- ON PREM: Software and hardware firewalls can also block ports from being access. Customer may need to contact their IT provider to allow access firewall
Restarting WEB API Service.
- Go to Windows Control panel and search for Services and click on View local services
- Services window will pop up. On the list of services search for S5WebAPI.
- Then hit start or restart.
Creating a Windows Scheduled Task to Restart the Service Daily
The purpose for setting up Task Scheduler for WEB API is to keep the WEB API from running. Task Scheduler will STOP and Start the WEB API. This will refresh the WEB API from running.
To Setup Task Scheduler for WEB API:
1. Go to Control Panel > System and Security > Administrative Tools
2. Open the Task Scheduler
3. Click on Create Task..
4. Task Name : S5WebAPISvc Restart
5. Description : This task will STOP and then START the System Five Web API Service
6. Select “Run whether user is logged on or not”
7. Select “Run with highest priviledge”
8. Switch to Triggers tab. Then click on New… button.
9. Set the following : Begin the Task : On a Schedule
Settings : Daily
Set the desired time. Example 2:00AM
Enable “Stop task if it runs longer than” : 30mins
10. Click OK.
11. Switch to Actions Tab. Then click on New… button.
12. Browse the RebootAPI.bat file
13. Click OK.
18. Switch to Conditions Tab.
19. Enable “Start the task only if the Computer Is on AC power”
Enable “Stop if the computer switches to battery power”
19. Switch to Settings Tab
20. Follow the settings below :
- Enable “Allow task to be run on demand”
- Enable “Run task as soon as possible after a scheduled start is missed”
- Enable “If the task fails, restart every : ” 1 minute
- Attempt to restart up to : 3 times
- Enable “Stop the task if it runs longer than” : 1 hour
- Enable “If the running task does not end when requested, force it to stop”
21. Then Click OK.
22. It will ask username and password of the server. Please enter it.
Creating RebootAPI.bat
This batch file will locate the PID number of the WEB API service then will force restart the WEB API Service.
1. Open Notepad.
2. Copy and paste this code to the notepad.
FOR /F "tokens=3" %%A IN ('sc queryex S5WebAPIService_Name ^| findstr PID') DO (SET pid=%%A) IF "!pid!" NEQ "0" ( taskkill /F /PID %PID% net start S5WebAPIService_Name )
3. Rename the S5WebAPIService_Name with the Service name that is installed in the server. 4. save it as RebootAPI.bat
Swagger Docs
Swagger docs contains the methods available in the WEB API. We highly recommend developers to use the methods in the swagger docs.
To use the Swagger docs file, we suggest to load the favorite Swagger editor. Ex. http://editor.swagger.io
Load the Windward Swagger docs on an internet browser and copy the JSON format to Swagger editor. Windward Swagger Docs : http://server:port/datasnap/rest/TServerMethodsWebAPI/swagger/swagger.json
On the Swagger editor, go to File > Clear Editor > Then Paste the Swagger JSON.
Swagger Documentation 2.0 Usage : http://wiki.wws5.com/doku.php?id=webapi_swagger_documentation
WEBAPI Queries
Connect
Method : Server:Port/datasnap/rest/TServerMethodsWebAPI/WebAPI_Connect
This method attempts to connect the Web API user to System Five. This can be useful for validating credentials.This method does not accept any parameters; it uses the Web API credentials to determine the Web API user to connect.If successful, the method will return a JSON containing the user's session GUID.
Refer to swagger docs for the parameter.
Get Parts
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/Get_Parts
This method fetches part (inventory) information from System Five.
Fields Parameter
This is a REQUIRED parameter that will restrict the fields that are returned.
Filters Parameter
This is a REQUIRED parameter that will restrict the parts that are returned.
Refer to swagger docs for the parameter.
GetPart Changes
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/Get_Part_Changes
This method fetches part information from System Five that has changed since a given date.
EffectiveDate Parameter This is a REQUIRED parameter that controls the effective date to use. This must be a date in ISO8601 format.
PageSize Parameter This is an optional parameter that controls the number of results per page.
PageNumber Parameter This is an optional parameter that controls which page of results is returned.
*NOTE* If either of the optional parameters is not provided, all results will be returned.
Refer to swagger docs for the parameter.
List Parts
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/List_Parts
This method lists basic part (inventory) information from System Five.
Note: running this method without parameters will return ALL inventory records in the system! This type of activity is very laborious and could time out, please be careful!
PartUniques Parameter This is an optional parameter that will restrict the fetch to only return parts with the specified PartUnique values. The following example will list part uniques 257 and 258:
Refer to swagger docs for the parameter.
Categories Parameter This is an optional parameter that will restrict the fetch to only return parts within the specified Categories. The following example will list categories 100 and 110:
Refer to swagger docs for the parameter.
Results This method will return the results of the request in JSON.
To pull up all categories in System Five :
http://PUBLICIP:PORT/Windward/WebAPI/Category/Categories/undefined
Insert Full Invoice
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/Insert_Full_Invoice
This method inserts a full invoice record in System Five.
Parameter
This parameter describes the invoice you want to insert, including invoice lines.
Required: InvoiceDate, Invoice_BookMonth, Invoice_Type, CustomerContextUnique.
IMPORTANT NOTES:
PartUnique numbers must exist in target System Five instance
Example Invoice Types are:
C(Cash), E(Estimate), W(Work Order) Note: Estimate type invoices cannot have Tender Types attached
NOTE: Estimate type invoices cannot have Tender Types attached
Example Tender Types are:
A(American Express), D(Debit), I(Discover), M(Mastercard), V(Visa)
Refer to swagger docs for the parameter.
Fetch Part Images (Old Deprecated)
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/“WebAPI_PartImages_Fetch”
This method fetches part images from System Five. This method is NOT like standard Get methods and does not support Fields or Filters.Instead you need to pass a list of PartUniques.
PartUniques Parameter
This is REQUIRED parameter that will restrict the records to return. This must be a PartUniques array that contains the PartUnique values you want to fetch. The following example will return images for part uniques 100 and 110.
Refer to swagger docs for the parameter.
Get Categories
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/Get_Categories
This method fetches all the category information from System Five.
Results This method will return the results of the request in JSON.
Refer to swagger docs for the parameter.
Insert Customer
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/Insert_Retail_Customer
Specialized version of Insert_Customer that accepts both FirstName and LastName parameters and uses them to properly format the Business Name property in System Five. If successful, returns an InsertRetailCustomer_Response.
Refer to swagger docs for the parameter.
Get Kits
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/Get_Kits
This method fetches kit information from System Five. Like standard Get methods it supports the use of Fields and Filters.
Fields Parameter This is an optional parameter that will restrict the fields to return. If not specified, all fields will be returned. The actual list of specified fields can be loaded from the Web API.
Parameter :
{ "Fields":["KitUnique","MainPartUnique","ChildPartUnique","IsSerial","Quantity"], "Filters":[{"Field":"MainPartUnique","Operator":"=","Value":" 17644"}] }
Result :
{ "result": [ { "Response": "Success", "Reason": "2 kits processed", "Results": [ { "KitUnique": "8", "MainPartUnique": "17644", "ChildPartUnique": "6025", "IsSerial": "N", "Quantity": "1.00000" }, { "KitUnique": "9", "MainPartUnique": "17644", "ChildPartUnique": "11119", "IsSerial": "N", "Quantity": "3.00000" } ], "Stopwatch": "0" } ] }
/RecState_FetchChanges
Method : Server:PORT/datasnap/rest/TServerMethodsWebAPI/RecState_FetchChanges
- Will return the id of the record that has been changed on a given effective date and fileNumber
- Filenumber 2 means customer record
- Filenumber 7 means inventory record
{ "FileNumber": 7, "EffectiveDate": "2018-08-15T11:56:18-07:00" }
Multi-Currency
This article will help you get the correct price based on the currency using WEB API.
Requirements :
1. WEB API version must be on 6.2.2.201 and above
2. System Five data must be configured for Multi currency
To get the price on a certain Currency, use the method Get method Inventory.
URl : http://PUBLIC_IP:PORT/Windward/WebAPI/Inventory/Inventory/{Inventory_Unique}?CurrencyCode={code}
Example : http://localhost:215/Windward/WebAPI/Inventory/Inventory/2?CurrencyCode=2
where inventory unique is 2 AND USD American currency is 2
WEBAPI Common Questions
How I could get a list of all fields that I am able to request for Parts?
Use Get_Parts method. here are the list of fields that you are able to request.
PartUnique = this is the unique number of an item
Category = The category number where the item is assigned. When using this field, it will return all parts under a specific Category
Item = Item number of the part. Usually it is similar with Part number
Part = Part number of the item
Supplier Part Number = Supplier Patnumber. Usually empty
SupplierUnique = Unique number of Supplier Name. When using Supplier Unique, it will return all parts under a specific Supplier Name.
How do we identify Matrix items in WEB API? What method and parameter to use?
Matrix parts are grabbed like any other part and here is how you can tell which parts are matrix parts:
Get_Parts()
- If the part is a matrix item the “KitType” field will be 1
List_Parts()
- A field has been added called “IsMatrix”, containing a Boolean value similar to the existing field “ECommerce”
Can't access web API
check if Web API service is running on the Server.
WEB API takes too much time to load
If using localhost to access WEB API, then their must be a problem with the API or the port.
If using the public IP address to access the WEB API, then it must be a port or a network issue.
Let them contact their Network administrator.
Web Developer : why I can't access the developer page? (IP:Port/developer)
Developer page is no longer available on the later version of WEB API.
Please refer to swagger documentation.
(IP:Port/datasnap/rest/TServerMethodsWebAPI/swagger/swagger.json)
Web Developer : Why /WebAPI_Parts_Gets taking too much time to load.
Methods that starts with /WebAPI are deprecated methods.
Avoid using Deprecated methods unless Techsupport advised to use it.
Please start using the updated methods in Web API.
Check teh swagger docs for the updated WEB API methods.
(IP:Port/datasnap/rest/TServerMethodsWebAPI/swagger/swagger.json)
Does WEB API support Multi-Currency?
As of version 6.2.2.201, WEB API is now supporting Multi -Currency
WEB API keeps on not responding.
Possible reason is that if there is no user interaction in the server, server will go into power saver mode.
Make sure that Power Saver mode is turned off.
https://blogs.technet.microsoft.com/exchange/2013/10/22/do-you-have-a-sleepy-nic/
3rd party Developer : I am able to connect to the API via a browser but not via a PHP script.
- Let the developer use Postman App to test the WEB API methods. (Send them the Using POST MAN.docx file)
- On Postman App, if You click On Code after You run a request, it will show You a sample snippets. PHP is one of the Snippets so You may use that On your script.
3rd party Developer : We are trying to move from old methods in WEB API to new Methods in WEB API. Could you list down the old method and its equivalent new methods?
Here’s a list of the old methods and its equivalent/suggested new methods to use.
• Parts_Get (old - deprecated)
- Parts_Get is actually the /WebAPI_Parts_Get and is definitely an old method. And is returning all parts in System Five including the DEFAULT Parts.
- I suggest use /Get_Parts method under TServerMethods and use this parameter below to get all parts in System Five. OR /Inventory/{InventoryId} under Inventory Endpoint and use the parameter 0 to get all parts in System Five.
Refer to swagger docs for the parameter.
Parameter for IP:Port/Windward/WebAPI/Inventory/ :
IP:Port/Windward/WebAPI/Inventory/0
• Parts_Read (old - deprecated)
- Parts_Read is actually the /WebAPI_Parts_Read an old method. I suggest use /Get_Parts under TServerMethodsWebAPI endpoint or /Inventory/{InventoryId} under Inventory Endpoint.
• Parts_List (old - deprecated)
- Parts_List is actually the /WebAPI_Parts_List an old method. Without parameter, this method very laborious and could time out.
- I suggest use /List_Parts method undert TServerMethodsWebAPI Endpoint.
Parameter :
Refer to swagger docs for the parameter.
• Categories_Get (old - deprecated)
- This method is the WebAPI_Categories_Get, an old method. This will fetch all categories in System Five.
- I suggest use the /Get_Categories under TServerMethodsWebAPI endpoint.
• MainCategories_Get (old - deprecated)
- This method is the /WebAPI_MainCategories_Get, also an old method. This will fetch all main categories in System Five.
- I suggest use the /Get_Main_Categories instead. This is under TServerMethodsWebAPI endpoint.
• PartImages_Fetch (old - deprecated)
- There is an old method called /WebAPI_PartImages_Fetch, this is an old method in WEBAPI. This will fetch the all images in parts.
It uses this parameter below to get the images.
{"PartUniques":["100","110"]}
- The new image fetch method is /PartImages_Fetch. Without WebAPI_ prefix. And it is using this parameter below.
{ "PartUnique": 0 }
- I suggest use the new /PartImages_Fetch method because /WebAPI_PartImages_Fetch is buggy.
• Customers_Get (old - deprecated)
- There is an old method called /WebAPI_Get_Customers. This is an old method and is using the parameter below
Refer to swagger docs for the parameter.
- the new Customers get method is /Get_Customers and it is using the exact parameter as /WebAPI_Get_Customers. This method is under TServerMethodsWebAPI endpoint.
- Another new method that could pull up customer record is /Customers/{Unique} which is under Customer endpoint.
parameter :
IP:Port/Windward/WebAPI/Customer/Customer/12
- I suggest /Customer/{Unique} method. Avoid using /WebAPI_Get_Customers method.
• Customers_GetByEmail (old - deprecated)
- /WebAPI_Get_Customer_By_Email this is an old method.
- Use this new method instead /Get_Customer_By_Email
parameter :
Refer to swagger docs for the parameter.
• Customers_Read (old - deprecated)
- /WebAPI_Customers_Read is an old method. Reads single customer record in System Five.
- I suggest use /Customers/{Unique} which is under Customer endpoint.
parameter :
IP:Port/Windward/WebAPI/Customer/Customer/12
• PartPrices_Fetch (old - deprecated)
- /WebAPI_Fetch_Part_Prices is an old method.
- I suggest use the /Get_Part_Prices instead.
Parameter :
Refer to swagger docs for the parameter.
- EffectiveDate is required and must be in ISO date format
• Parts_FetchChanges (old - deprecated)
- /WebAPI_Fetch_Part_Changes is an old method which fetches the part information from System Five that has changed since a given date
- use /Get_Part_Changes instead. Effectivedate must be in ISO date format
parameter :
Refer to swagger docs for the parameter.
• Customers_FetchChanges (old - deprecated)
- /WebAPI_Fetch_Customer_Changes is an old method which fetches customers from System Five that have changed since a given date.
- Use /Get_Customer_Changes instead. Effectivedate must be in ISO date format
Parameter :
Refer to swagger docs for the parameter.
• Insert_Full_Invoice
- This is the recommended method for inserting Invoice in System Five.
• Customers_Insert (old - deprecated)
- /WebAPI_Customers_Insert is an old method
- Use /addCustomer under Customer endpoint
- When using /addCustomer endpoint, default customers must be configured properly in System Five and enable the “select default customer by country and region on dataload”. WEB API will use default customers as a template when creating new customer in System Five.
url : IP:Port/Windward/WebAPI/Customer/addCustomer
Refer to swagger docs for the parameter.
Are VirtualPartUnique and PartUnique required? If we're creating a new item, we can't know these IDs
- VirtualPartUnique is required when creating new item.
- when you use this /VirtualInventory/{VirtualPartUnique} method and PartUnique is not equal to “0” then that means that the virtual warehouse is already created as a regular item
- If you want to create new virtual warehouse, you may want to check the most recent virtualPartUnique number.
- Use the /GetVirtualInventoryRecordCount then it will return the number of VirtualItem in System Five.
- You will need to add 1 on the return count for /GetVirtualInventoryRecordCount.
- For example, If it returns 40 counts then this means that the last VirtualUnique created is 41. I think the reason being is that Unique number 1 is used for default Virtual item.
Will this method (/addVirtualInventory) update the part if it exists? If yes, will it match by SupplierUnique + SupplierPartNumber?
- /addVirtualInventory is the method used to update or add virtual warehouse.
- If VirtualPartUnique and PartUnique match the item in System Five, then it will update the virtualInventory but wont update the regular inventory linked to the virtualinventory.
- If SupplierUnique + SupplierPartNumber in the parameter doesn’t match in the System Five, then WEB API will override the SupplierUnique and SupplierPartNumber in virtualWarehouse but wont make any changes on the regular inventory.
Tax Configuration For WEB API Integration
Taxes are configured in both the Website and in System5. The WEB developer of the website will configure the Tax calculation in the website while Windward staff will educate the customer on how to setup Taxes.
When configuring the taxes for Web API integration, we must ensure that the Tax Priority is set to Customer Tax Area. In System5 go to Setup Wizard > Taxes > Invoice Tax Area Priority. Invoices coming from the Website are taxed based on the area of the customer attached to the invoice.
Please see the example below.
* Creating Tax rule for customers from Ontario Canada. This should be calculated by 12.5%
1. Go to Setup Wizard > Taxes
2. Add a new tax rule
3. Tax configuration for Third party integration, you will need to use Country code – Province code for Tax area.
Ex : CA-ON
CA for Canada and ON for Ontario.
4. Effective date should be set the day ahead. So that it won't affect the accounting side of System Five
5. Once the Tax rule has been setup, you will need to create a DEFAULT Customer for that particular Tax area.
When creating default customer, ensure that the Business Name format should be DEFAULT-CountryCode-ProvinceCode.
Ex: (DEFAULT-CA-ON).
Ensure that the Country and Province is selected properly on the default customer you just created.
Shipping Configuration
Create a partnumber “SHIPPING” in system5. Ensure that the SHIPPING part is assign under non-inventory category. Put 0.00 value for the SHIPPING part.
Common Errors/Issues
Getting POS Failure! {“error”:“Assertion failure (R:\system5\projects\prgs\FullInvoice.pas, line 50886)”} when pushing an order through WEB API .
Reasons : The JSON that is being used is invalid.
Only 1 InvoiceLines Array is allowed. The Description must only have 255 characters MAXIMUM! The database will throw away anything longer. The Invoice Comment must not contain invalid characters. (Carriage Returns and Line Feeds)
Additional information: You do not need to include the InvoiceCustomer / InvoiceShipTo unique numbers AND the InvoiceShipping / InvoiceBilling One or the other is all that is required. If you know the Unique Numbers, use them. The system will ignore the InvoiceShipping and InvoiceBilling data. If you don’t, then use the InvoiceShipping and InvoiceBilling. The system will look-up the Account records or create them.
Here is what is should look like:
{ "Invoice": [ { "InvoiceHeader": { "InvoiceSubTotal": 87, "InvoiceTaxTotal": 8.97, "InvoiceOrdered": "2019-08-13T16:15:11.282Z", "InvoiceDate": "2019-08-13T16:15:11.282Z", "InvoiceType": "W", "InvoiceSubType": "O", "InvoiceDepartment": 0, "InvoiceBookMonth": "2019-08-13T16:15:11.282Z", "InvoiceCustomer": 31599, "InvoiceShipTo": 31599, "InvoiceSalesman": 1, "InvoiceComment": "This is a test order. Please do not process! Item 1: This is a delivered product. Delivery 321 elm street 60607 Business. Product Name: Arrangement. Product Options: Color: Earth - 0, Size: Large - 20, Delivery: 60607 - 17. Recipient: TesterChicago, 3332221111, testerchicago@floodlightdesign.com. Card message: Hi, nnLook forward to you receiving these testing flowers.nnJoe. Delivery date 08/31/19." }, "InvoiceTenders": [ { "Type": "O", "Amount": 95.92 } ], "InvoiceLines": [ { "PartUnique": 15868, "Ordered": 1, "Price": 50, "Description": "This is a test order. Please do not process!" }, { "Part": "SHIPPING", "Ordered": 1, "Price": 17, "Description": "SHIPPING/DELIVERY" } ] } ], "ConnectionInfo": { "TerminalNumber": 0 } }
You can prevent all of these problems by simply checking the JSON payload in a JSON editor like: https://jsoneditoronline.org/
Adding Newline Feed on Invoice Comment
In /addInvoice method, you can add Invoice Comment. In the parameter, look for this field “InvoiceComment” and add your comment.
To add a new line feed, add this \\n in the comment.
Access Violation when making API call
When troubleshooting the s5webAPI if receiving an access violation when making and API call, XML may require re-installation.