Including them in the Attribute collection of a Stock Item doesn't seem to work -- even if I make sure the attribute ids already exist in the db. When I do the PUT request, the rest of the data in the record is inserted, but not the attributes. The response even returns an empty attribute array instead of what I sent to it.
Do I need to extend the API for this to work? If so, does anyone have any examples? I haven't been able to find any yet.
The request is:
http://localhost/acum172100034/entity/Default/17.200.001/StockItem
The body is:
{
"InventoryID": {
"value": "RGTONYIT166"
},
"Attributes": [
{
"AttributeID": {
"value": "Item Attribute"
},
"Value": {
"value": "2"
}
}
]
}
The PUT response is:
{
"id": "665e403c-d310-4bb4-9759-e2487dd5abc7",
"rowNumber": 1,
"note": null,
"ABCCode": {},
"Attributes": [],
"AutoIncrementalValue": {},
"AverageCost": {
"value": 0
},
"BaseUOM": {
"value": "EA"
},
"COGSAccount": {
"value": "50000"
},
"COGSSubaccount": {
"value": "CON000"
},
"Content": {},
"CurrentStdCost": {
"value": 0
},
"DefaultIssueLocationID": {
"value": "R1S1"
},
"DefaultPrice": {
"value": 0
},
"DefaultReceiptLocationID": {
"value": "RECEIVING"
},
"DefaultWarehouseID": {
"value": "WHOLESALE"
},
"DeferralAccount": {},
"DeferralSubaccount": {},
"Description": {
"value": "tonyitem166 - blah blah 2"
},
"DimensionVolume": {
"value": 3
},
"DimensionWeight": {
"value": 2
},
"DiscountAccount": {},
"DiscountSubaccount": {},
"ImageUrl": {},
"InventoryAccount": {
"value": "12100"
},
"InventoryID": {
"value": "RGTONYIT166"
},
"InventorySubaccount": {
"value": "CON000"
},
"IsAKit": {
"value": false
},
"ItemClass": {
"value": "CONSUMER 200FITNESS"
},
"ItemStatus": {
"value": "Active"
},
"ItemType": {
"value": "Finished Good"
},
"LandedCostVarianceAccount": {
"value": "52400"
},
"LandedCostVarianceSubaccount": {
"value": "CON000"
},
"LastCost": {
"value": 0
},
"LastModified": {
"value": "2018-10-02T17:13:38.707-04:00"
},
"LastStdCost": {
"value": 0
},
"LotSerialClass": {
"value": "NOTTRACKED"
},
"Markup": {
"value": 0
},
"MaxCost": {
"value": 0
},
"MinCost": {
"value": 0
},
"MinMarkup": {
"value": 0
},
"MSRP": {
"value": 0
},
"PackagingOption": {
"value": "Manual"
},
"PackSeparately": {
"value": false
},
"PendingStdCost": {
"value": 0
},
"POAccrualAccount": {
"value": "20100"
},
"POAccrualSubaccount": {
"value": "CON000"
},
"PostingClass": {
"value": "CON"
},
"PriceClass": {},
"PriceManager": {},
"PriceWorkgroup": {},
"ProductManager": {},
"ProductWorkgroup": {},
"PurchasePriceVarianceAccount": {
"value": "52300"
},
"PurchasePriceVarianceSubaccount": {
"value": "CON000"
},
"PurchaseUOM": {
"value": "EA"
},
"ReasonCodeSubaccount": {
"value": "CON000"
},
"SalesAccount": {
"value": "40000"
},
"SalesSubaccount": {
"value": "CON000"
},
"SalesUOM": {
"value": "EA"
},
"StandardCostRevaluationAccount": {
"value": "52110"
},
"StandardCostRevaluationSubaccount": {
"value": "CON000"
},
"StandardCostVarianceAccount": {
"value": "52100"
},
"StandardCostVarianceSubaccount": {
"value": "CON000"
},
"SubjectToCommission": {
"value": false
},
"TaxCategory": {
"value": "TAXABLE"
},
"ValuationMethod": {
"value": "Average"
},
"VolumeUOM": {},
"WeightUOM": {},
"custom": {},
"files": []
}
If the Attributes are already present on the Stock Item screen, then you can use the Default endpoint and you only need to make a PUT call specifying the Inventory ID and the Attribute ID like so:
PUT : localhost/demo172u10/entity/Default/17.200.001/StockItem
{
"InventoryID": {"value": "AACOMPUT01"},
"Attributes":
[
{
"AttributeID": {"value": "Color"},
"Value": {"value": "Black"}
},
{
"AttributeID": {"value": "Configurable Attributes"},
"Value": {"value": "Test"}
}
]
}
This would update the "Color" and "Configurable Attributes" Attributes of the AACOMPUT01 Stock Item with the value specified.
If the Attribute is not on the Stock Item screen then you would need to use the API to target the Item Class screen to add the Attributes that you want there. As if you go to the Stock Item screen you might notice that you cannot add new attributes directly on that screen and that they are actually coming from the Item Class of the Item itself.
This test was done using the Sales Demo Data with Acumatica Version 17.210.0034
This is a guess, but I think you need to add your attributes to your stock item class. Go to IN201000
This ended up being an issue with my own code that was apparently hiding the attributes from the view so that they wouldn’t update. Once I resolved that, now it's working by just include them in the Attributes collection.
Related
I am doing an integration with Acumatica.
In my SalesOrder request, I am creating a Sales Order with Bill-To Address and Ship-To Address.
After the request was made I have check in acumatica Sales Order that the Sales Order do not have the Bill-To and Ship-To Address as specified in my request.
It seems that it is using the Default Address that was set in the CustomerID
Here is a sample API which shows how to override the Ship-To address. Pay attention to the ShipTo entity declared
{
"OrderNbr": {
"value": "37631"
},
"OrderType": {
"value": "SO"
},
"Date": {
"value": "12/18/20 2:21:10 PM"
},
"note": " ",
"CustomerID": {
"value": "ABC123"
},
"ExternalRef": {
"value": "37631"
},
"Description": {
"value": "Self Import"
},
"CustomerOrder": {
"value": " "
},
"Processed": {
"value": false
},
"ShippingSettings": {
"Priority": {
"value": 2
},
"ShipVia": {
"value": "2ND_DAY"
}
},
"ShipToContactOverride": {
"value": true
},
"ShipToContact": {
"BusinessName": {
"value": "Bob Jones"
},
"Attention": {
"value": ""
},
"Phone1": {
"value": ""
},
"Email": {
"value": ""
}
},
"ShipToAddressOverride": {
"value": true
},
"ShipToAddress": {
"AddressLine1": {
"value": "123 Main Street"
},
"AddressLine2": {
"value": ""
},
"AddressLine3": {
"value": ""
},
"City": {
"value": "Ft. Smith"
},
"State": {
"value": "AR"
},
"PostalCode": {
"value": "72913"
}
},
"Details": [
{
"InventoryID": {
"value": "7239-1"
},
"OrderQty": {
"value": 2
},
"UnitPrice": {
"value": 35.07
}
},
{
"InventoryID": {
"value": "7543"
},
"OrderQty": {
"value": 2
},
"UnitPrice": {
"value": 436.98
}
},
{
"InventoryID": {
"value": "6243-2"
},
"OrderQty": {
"value": 8
},
"UnitPrice": {
"value": 5.43
}
}
]
}
I'm testing an order submission via Postman, just passing this JSON structure to /SalesOrders.
{
"Details": [
{
"InventoryID": {
"value": "TEST-SKU"
},
"WarehouseID": {
"value": "BUF"
},
"LineNbr": {
"value": 1
},
"OrderQty": {
"value": 2
},
"UnitPrice": {
"value": 285
}
}
],
"CustomerID": {
"value": "0000003759"
},
"Hold": {
"value": false
},
"Description": {
"value": "WEBTEST-1000123456"
},
"ExternalRef": {
"value": "1000123456"
},
"BillToAddressOverride": {
"value": true
},
"ShipToAddressOverride": {
"value": true
},
"Totals": {
"FreightCostIsuptodate": {
"value": true
},
"OverrideFreightPrice": {
"value": true
},
"FreightCost": {
"value": 41.89
},
"Freight": {
"value": 41.89
}
},
"PaymentMethod": {
"value": "APSCRCARD"
},
"NewCard": {
"value": true
},
"PaymentCardIdentifier": {
"value": "APSCRCARD:****-****-****-1234"
},
"PaymentRef": {
"value": "12345678910"
},
"ShipToContact": {
"Attention": {
"value": "Test User"
},
"BusinessName": {
"value": "Testing Company"
}
},
"BillToAddress": {
"AddressLine1": {
"value": "123 Test Lane"
},
"AddressLine2": {
"value": ""
},
"AddressLine3": {
"value": ""
},
"AddressLine4": {
"value": ""
},
"City": {
"value": "Buffalo"
},
"Country": {
"value": "US"
},
"PostalCode": {
"value": "14216"
},
"State": {
"value": "NY"
},
"rowNumber": {
"value": 1
}
},
"ShipToAddress": {
"AddressLine1": {
"value": "123 Test Lane"
},
"AddressLine2": {
"value": ""
},
"AddressLine3": {
"value": ""
},
"AddressLine4": {
"value": ""
},
"City": {
"value": "Buffalo"
},
"Country": {
"value": "US"
},
"PostalCode": {
"value": "14216"
},
"State": {
"value": "NY"
},
"rowNumber": {
"value": 1
}
},
"ShippingSettings": {
"shipVia": {
"value": "BUFFEDEX2DAY"
}
}
}
It's getting hung up when I'm trying to pass over cc information and I'm not exactly sure what to do. It says the Payment Card Identifier field is empty but as you can see I'm passing a value to it.
"SalesOrder.PaymentCardIdentifier: 'Identifier' cannot be empty.\nInserting 'CustomerPaymentMethodC' record raised at least one error. Please review the errors."
I'm not sure if I need to be using a different value but I'm repurposing one that I received on a call to get Sales Orders from Acumatica.
I was curious if I potentially have to add the CustomerPaymentMethod before adding the order? Any help around this would be greatly appreciated.
The Validation message mentions SalesOrder.PaymentCardIdentifier being empty not PaymentCardIdentifier so are you sure you have the correct request format?
Please check the Endpoint to see how this field is being defined in the SalesOrder Entity. That field is not part of the default endpoint - so I can't check it, but perhaps the name is spelled differently.
So it turned out, regarding this, that I was referencing an incorrect endpoint in our system (a custom one as opposed to Default).
I also had to add payment to the Payment sub-object as opposed to the Sales Order object directly.
Thank you everyone for the assistance!
Hi I want to set the Note field as part of my PUT request when adding a new activity record in Advanced.
I have my custom endpoint setup and I can insert the activity record no worries except setting the Note system field doesnt seem to do anything?
Here is an example of my JSON for the request
{
"Note": "narrtion test five",
"Summary": {
"value": "Test Task Status"
},
"Type": {
"value": "W"
},
"ActivityDate": {
"value": "2020-03-04T00:00:00"
},
"StartTime": {
"value": "0001-01-01T15:00:00"
},
"Owner": {
"value": "MATTMCD"
},
"Status": {
"value": "Completed"
},
"CostCode": {
"value": "0000"
},
"EarningType": {
"value": "RG"
},
"Billable": {
"value": true
},
"LabourItem": {
"value": "LABOUR-MAT"
},
"Project": {
"value": "PR00000001"
},
"ProjectTask": {
"value": "TESTTASK"
},
"TimeSpent": {
"value": "0:30"
},
"ActivityDetails": {
"value": "narrtion test five"
}
}
Would appreciate some help with this?
Can you try with "note" instead of "Note" ?
{
"note": "narrtion test five",
...
}
Using acumatica web services (json REST api), how can I set the TaxZone when I create an Invoice. Here's a sample json put request:
{
"Date": { "value": "12/23/2019" },
"DueDate": { "value": "12/23/2019" },
"Customer": { "value": "12345" },
"Type": { "value": "Invoice" },
"LinkBranch": { "value": "MYBRANCH" },
"FinancialDetails": {
"TaxZone": { "value": "1" }
}
}
I have tried that, tried TaxZoneId, tried posting without using FinancialDetails object... nothing seems to work.
The easiest way to get the correct structure of the JSON is to send get request with "expand" parameter like below:
http://localhost/ACU19200/entity/Default/18.200.001/SalesInvoice/Invoice|AR007541?$expand=FinancialDetails
This will return you the Invoice record with Financial Details, like below:
{
"id": "7bd77116-dcf1-e911-b312-fc017c8c8936",
"rowNumber": 1,
"note": "",
"Amount": {
"value": 2385.0000
},
"Balance": {
"value": 1910.0000
},
"CashDiscount": {
"value": 0.0000
},
"CreditHold": {
"value": false
},
"Currency": {
"value": "USD"
},
"CustomerID": {
"value": "ABARTENDE"
},
"CustomerOrder": {},
"Date": {
"value": "2019-10-18T00:00:00-07:00"
},
"Description": {},
"DueDate": {
"value": "2019-11-17T00:00:00-08:00"
},
"FinancialDetails": {
"id": "1b004ff5-496f-463e-8b37-f6c74a044482",
"rowNumber": 1,
"note": null,
"BatchNbr": {
"value": "AR006749"
},
"Branch": {
"value": "PRODWHOLE"
},
"CustomerTaxZone": {},
"custom": {},
"files": []
},
"Hold": {
"value": false
},
"Project": {
"value": "X"
},
"ReferenceNbr": {
"value": "AR007541"
},
"Status": {
"value": "Open"
},
"Type": {
"value": "Invoice"
},
"VATExemptTotal": {
"value": 0.0000
},
"VATTaxableTotal": {
"value": 0.0000
},
"custom": {},
"files": []
}
Now after we have the structure we need to remove the redundant fields from the request and send the PUT request with the JSON like below (of course in your case you need to also provide invoice details and other information):
{
"CreditHold": {
"value": false
},
"Currency": {
"value": "USD"
},
"CustomerID": {
"value": "ABARTENDE"
},
"Description": {
"value" : "Test Invoice"
},
"Hold": {
"value": false
},
"Status": {
"value": "Open"
},
"Type": {
"value": "Invoice"
},
"FinancialDetails": {
"CustomerTaxZone": {
"value": "AVALARA"
}
}
}
You will need to extend the default endpoint if you need to work with AR Invoice (Default/18.200.001/Invoice) because it doesn't contain CustomerTaxZone by default.
You can do it as shown below and then just send CustomerTaxZone as "TaxZone" on the top level.
Automating creation of Sales Invoice via Rest API
Unable to get CustomerLocation to populate
In the WebService EndPoint the Mapped Object and Mapped Fields are blank for this item
Has any one successfully used this API to modify Location?
Does any one know if I have a formatting error in my JSON for Linked Entities, it matches the documentation but may not be up to date?
Tried several formats of JSON based on the guide and experience including Linked, Summary, Custom and Detail
Tried both BillToSettings and BillingSetting Entities
Searched Known issues, Newton JSon
"Type": { "value": "Invoice" },
"CustomerID": { "value": "C0004055" },
/// bit does not create in Acumatica
"BillToSettings": { "CustomerLocation": { "value": "67217" } },
/// "BillingSettings" : {"CustomerLocation" : {"value" : "67217"}
/// also LocationID, CustomerLocationID and many combinations there of
"CustomerOrder": { "value": 1942 },
"Date": { "value": "2/14/2019" },
"Description": { "value": "SO S048773" },
"Details": [
{
"InventoryID": { "value": "POLLING-HOSTING" },
"TransactionDescr": { "value": "GPRS Monitoring" },
"UOM": { "value": "PNTS" },
"Qty": { "value": "3" },
"UnitPrice": { "value": "68.25" }
},
{
"InventoryID": { "value": "AIRTIME" },
"TransactionDescr": { "value": "GPRS Airtime" },
"UOM": { "value": "EACH" },
"Qty": { "value": "3" },
"UnitPrice": { "value": "20" }
}
]
I expect the Default MAIN location to be overridden with 67217 instead every record shows main
If I add the address Override fields (as below) then I get data for them on the successful creation of the invoice but no CustomerLocation data is returned.
Nor does the LocationID update correctly
BillingSettings = new
{
BillToAddressOverride = new {value = true},
BillToContactOverride = new { value = true },
CustomerLocation = new { value = "67217"}
},
I tried to use your JSON example on a clean SalesDemo install of 2019R1 and could replicate the same issue that you're experiencing.
I think it has to do with the CustomerLocation field not being mapped in the Default 18.200.001 endpoint. It actually makes sense if we look at the response object - there is no CustomerLocation field in the response either.
First Attempt, without extending the API endpoint:
{
"Type": {
"value": "Invoice"
},
"CustomerID": {
"value": "ABARTENDE"
},
"Date": {
"value": "5/10/2019"
},
"Description": {
"value": "Test SalesInvoice Creation"
},
"BillingSettings" : {
"CustomerLocation" : {
"value" : "VEGAS"
}
}
}
Response from the first attempt:
"BillingSettings": {
"BillToAddress": {
"AddressLine1": {
"value": "201 Lower Notch Rd"
},
"AddressLine2": {},
"City": {
"value": "Little Falls"
},
"Country": {
"value": "US"
},
"PostalCode": {
"value": "07424"
},
"State": {
"value": "NJ"
}
},
"BillToAddressOverride": {
"value": false
},
"BillToContact": {
"Attention": {
"value": "Accounts Receivable"
},
"BusinessName": {
"value": "USA Bartending School"
},
"Email": {
"value": "barkeep#usabartend.con"
},
"Phone1": {
"value": "+1 (908) 532-9522"
}
},
"BillToContactOverride": {
"value": false
}
}
If you extend the endpoint and implement the Location field which can be found under the Invoice Summary selection when populating the field, you should be able to achieve your intended outcome. PS. I added the Location on the SalesInvoice object itself, and not on the BillingSettings object:
Second Request, the extended endpoint includes the Location field that was added:
{
"Type": {
"value": "Invoice"
},
"CustomerID": {
"value": "ABARTENDE"
},
"Date": {
"value": "5/10/2019"
},
"Description": {
"value": "Test SalesInvoice Creation"
},
"Location" : {
"value" : "VEGAS"
}
}
Second Response:
{
"Amount": {
"value": 0
},
"Balance": {
"value": 0
},
"BillingSettings": {
"BillToAddressOverride": {
"value": false
},
"BillToContactOverride": {
"value": false
}
},
"Currency": {
"value": "USD"
},
"CustomerID": {
"value": "ABARTENDE"
},
"Date": {
"value": "2019-05-10T00:00:00+00:00"
},
"Description": {
"value": "Test SalesInvoice Creation"
},
"DueDate": {
"value": "2019-06-09T00:00:00+02:00"
},
"Hold": {
"value": false
},
"Location": {
"value": "VEGAS"
},
"ReferenceNbr": {
"value": "AR006994"
},
"Status": {
"value": "Balanced"
},
"Type": {
"value": "Invoice"
}
}
As to whether the CustomerLocation holds any meaningful value/purpose, I'm not sure, so I left it in the BillingSettings as is.