Having an Issue with a JSON request. I'm getting an "The remote server returned an error: (422) Unprocessable Entity." Error returned. I've gone line by line through the API user Guide and have only found one anomaly. I don't know if this would cause the error.
Here is the complete JSON statement:
{"service":{"level":"STD"},"payment":{"terms":"Prepaid","payer":"Third Party"},"transit":{"pickupDate":"20230728"},"commodities":[{"classification":"60","weight":"2600","length":"42","width":"42","height":"45","pieces":"2","packageingType":"PAT","description":"USED BOOKS","stackable":"Y"}],"origin":{"account":"","city":"Knoxville","stateProvince":"TN","postalCode":"37918","country":"USA"},"destination":{"account":"","city":"Atlanta","stateProvince":"GA","postalCode":"30306","country":null},"billTo":{"account":"0627227","name":"FMS","address":"3517 Neil Dr","city":"Knoxvile","stateProvince":"TN","postalCode":"37918","country":"USA"}}
*****Below is the user guide example for the commodities;
**** Here's what I'm sending in:
There seems to be (in what I'm sending in) a linefeed after the word "commodities": [ {
as the API example shows ""commodities" : [ {" No line feed between the "[" & "{ ".
**** The Magic Questions *** Would that line feed cause the error and most important how do I get rid of it? I'm very new with JSON and work solo so any help would be greatly appreciated.
Dim Load As New fgtload
Dim Item1 As New items
With Item1
.classification = ("60")
.weight = ("2600")
.length = ("42")
.width = ("42")
.height = ("45")
.pieces = ("2")
.packageingType = ("PAT")
.description = ("USED BOOKS")
.stackable = ("Y")
End With
Load.commodities.Add(Item1)
Public Class fgtload 'Primary wrapper
Public service As New fgtservice
Public payment As New fgtpayment
Public transit As New fgttransit
Public commodities As New List(Of Items)
Public origin As New fgtorigin
Public destination As New fgtdestination
Public billTo As New fgtbillto
End Class
Public Class Items
Public classification As String 'class required
Public weight As String '7max lbs required
Public length As String '3max required
Public width As String '3max required
Public height As String '3 max required
Public pieces As String ' 5 max required
Public packageingType As String 'required PAT for Pallet , LSE for Loose
Public description As String 'required
Public stackable As String 'required
End Class