Employee Time Activity Entry through Endpoint - acumatica

Hi im trying to do a PUT request for a Employee Time Activity but im not having much luck. I keep getting errors like project task cannot be found in the system. But the project task does exist and when I enter the same details directly in the form it works fine.
Does anybody have a example JSON body of creating a new employee activity record that can help me?
Below is my current body
{
"Employee": {
"value": "MATTMCD"
},
"Items": [
{
"ActivityDate": {
"value": "2020-03-02T00:00:00"
},
"ActivityTime": {
"value": "2020-03-01T22:00:00"
},
"CostCode": {
"value": "0000"
},
"Billable": {
"value": true
},
"LabourItem": {
"value": "LABOUR-MAT"
},
"Project": {
"value": "PR00000001"
},
"ProjectTask": {
"value": "TESTTASK"
},
"Description": {
"value": "Labour Matt"
},
"TimeSpent": {
"value": "01:30"
}
}
]
}

I ended up just using the activity screen to enter time activities. This gave me some flexibility with the dates as well which I needed instead of having to enter a time entry for the current week.

Related

Cannot find mapping for Status field

My application is integrated with Acumatica 2020R2. When I try to create a task (PUT /ProjectTask) with such body:
{
"Description": {
"value": "xxx"
},
"ProjectID": {
"value": "xxx"
},
"TaskID": {
"value": "xxx"
},
"Type2020R1": {
"value": "CostRev"
}
}
I get an error: Cannot find mapping for Status field: status.. The same when I add "Status" value to the payload. Any idea what this message means and when it can occur?
As I wrote in the comment above: client is using different Acumatica version (2021R1), our integration doesn't support it.

Error submitting Sales Order to Acumatica

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!

Update Note System field on a PUT request using Endpoint Rest API

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",
...
}

Issues with Acumatica REST Contract-Based API SalesInvoice Entity 18.200.001

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.

Acumatica API insert data "Bad Request"

I'm trying to insert a stock item into Acumatica using the API, but I'm getting a 400 error - Bad Request. I'm using HttpClient to login, retrieve a stock item, and send the insert request. All is working except the insert request. I have tried the following url (including expand parameter):
http://localhost/AcumaticaERP/entity/Default/6.00.001/StockItem?$expand=Attributes,CrossReferences,UOMConversions,VendorDetails,WarehouseDetails
... and also the following url (without expand parameter)
http://localhost/AcumaticaERP/entity/Default/6.00.001/StockItem
I'm calling via HttpClient PutAsync, passing in the URLs mentioned above, and the data is JSON from a stock item retrieved with the API, and which doesn't exist in the current db.
client.PutAsync(insertUrl, new StringContent(data, Encoding.UTF8, "application/json")).Result;
Any ideas what I'm missing?
NEW DETAILS:
After further debugging and testing with Postman, the error from the PUT seems to be "Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1." The JSON was taken directly from a GET though, so I'm not sure what the problem could be. Below is the JSON returning an error from the PUT.
[
{
"id": "cc27ce56-6302-4f1b-97aa-49cca3ed32ea",
"rowNumber": 1,
"note": "",
"Attributes": [],
"BaseUOM": {
"value": "EA"
},
"CrossReferences": [],
"DefaultIssueLocationID": {
"value": "R1S1"
},
"DefaultReceiptLocationID": {
"value": "RECEIVING"
},
"DefaultWarehouseID": {
"value": "WHOLESALE"
},
"Description": {
"value": "tonyitem2"
},
"ImageUrl": {},
"InventoryID": {
"value": "TONYITEM2"
},
"IsAKit": {
"value": false
},
"ItemClass": {
"value": "CONSUMER 300TOYS"
},
"ItemStatus": {
"value": "Active"
},
"ItemType": {
"value": "Finished Good"
},
"LastModified": {
"value": "2018-08-03T12:09:19.907-04:00"
},
"LotSerialClass": {
"value": "NOTTRACKED"
},
"PurchaseUOM": {
"value": "EA"
},
"SalesUOM": {
"value": "EA"
},
"UOMConversions": [],
"VendorDetails": [],
"Volume": {
"value": 0
},
"WarehouseDetails": [
{
"id": "3ca5ea4c-c651-498e-8e6c-49119481982c",
"rowNumber": 1,
"note": "",
"DefaultIssueLocationID": {
"value": "R1S1"
},
"DefaultReceiptLocationID": {
"value": "RECEIVING"
},
"IsDefault": {
"value": true
},
"QtyOnHand": {
"value": 0
},
"WarehouseID": {
"value": "WHOLESALE"
},
"custom": {},
"files": []
}
],
"Weight": {
"value": 0
},
"custom": {},
"files": []
}
]
I also tried removing the brackets surrounding the JSON, and then the error is:
"No entity satisfies the condition.". Could the issue be that the ids have GUIDs, but I'm trying to do an insert? How do you indicate that the PUT is supposed to be inserting?
I finally got the PUT to insert. What finally worked was removing the wrapping braces "[" and "]" around the entire JSON; plus removing all "id", "rowNumber", "custom", and "files" fields, and all empty collections (e.g. Attributes, CrossReferences) in my JSON. I'm not sure which of these being removed resolved it and allowed me to insert, but it finally worked.
It's real unfortunate that the JSON you retrieve via GET can't be inserted via PUT without stripping all of this out first though. What a pain.

Resources