Regarding CSI in the cloud
Does anyone have any sample code that shows how to create a new Customer Order using the UpdateCollection method in the REST API and is it even possible? I'd rather not go the BOD route in ION if possible.
Got it figured out on my own, at least the header portion
Private Sub btnCreateSampleOrder_Click(sender As Object, e As EventArgs) Handles btnCreateSampleOrder.Click Dim Order As String = "STTEST1" Dim Customer As String = " 971110" Dim ShipTo As String = "0" Dim Status As String = "O" Dim OrderDate As String = "2023-06-01" Dim OrderType As String = "R" Dim Warehouse As String = "MAIN" Dim OrderDiscountType As String = "P" ' Percent Dim CurrencyCode As String = "USD"
Dim RowPointer As String = "" Dim JSon As String = ""
Call GetTokenV2API()
'// Update the Order Header Information Using client = New HttpClient() Dim WriteBackUrl As String = m_TenantURL & "update/SLCos?refresh=true"
'// provide token in the Authorization header client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", m_Token)
'// Set the properties to update back to CSI Dim updOrder As UpdateProperty = New UpdateProperty With { .Name = "CoNum", .Value = Order, .IsNull = False, .Modified = True } Dim updCustomer As UpdateProperty = New UpdateProperty With { .Name = "CustNum", .Value = Customer, .IsNull = False, .Modified = True } Dim updShipTo As UpdateProperty = New UpdateProperty With { .Name = "CustSeq", .Value = ShipTo, .IsNull = False, .Modified = True } Dim updStatus As UpdateProperty = New UpdateProperty With { .Name = "Stat", .Value = Status, .IsNull = False, .Modified = True } Dim updOrderDate As UpdateProperty = New UpdateProperty With { .Name = "OrderDate", .Value = OrderDate, .IsNull = False, .Modified = True } Dim updOrderType As UpdateProperty = New UpdateProperty With { .Name = "Type", .Value = OrderType, .IsNull = False, .Modified = True } Dim updWarehouse As UpdateProperty = New UpdateProperty With { .Name = "Whse", .Value = Warehouse, .IsNull = False, .Modified = True } Dim updDiscType As UpdateProperty = New UpdateProperty With { .Name = "DiscountType", .Value = OrderDiscountType, .IsNull = False, .Modified = True } Dim updCurrencyCode As UpdateProperty = New UpdateProperty With { .Name = "CurrCode", .Value = CurrencyCode, .IsNull = False, .Modified = True } '// Create the IDOITEM object to contain the properties (fields) we are updating Dim idoItem As IDOUpdateItem = New IDOUpdateItem With { .Action = UpdateAction.Insert, .Properties = {updOrder, updCustomer, updShipTo, updStatus, updOrderDate, updOrderType, updWarehouse, updDiscType, updCurrencyCode}, .ItemId = RowPointer }
'// Build the request object that contains the IDOITEM object to update Dim request As UpdateCollectionRequest = New UpdateCollectionRequest With {.Changes = {idoItem}}
'// Serialize the request object into JSON Dim contentStr As String = JsonConvert.SerializeObject(request)
'// Call the API with the JSON string Dim response As HttpResponseMessage = client.PostAsync(WriteBackUrl.ToString(), New StringContent(contentStr, Encoding.UTF8, "application/json")).Result
'// Evaluate the response from the API Call Using content As HttpContent = response.Content Dim result As Task(Of String) = content.ReadAsStringAsync() JSon = result.Result RowPointer = GetJSONItemIdAttribute(JSon) End Using
End Using End Sub