Solved

API insert data latitude longitude

  • 19 October 2022
  • 9 replies
  • 140 views

Userlevel 3
Badge
  • Jr Varsity III
  • 51 replies

What API can I use to insert longitude latitude for customer location, I found in customer location api but I don't find longitude latitude field? 

icon

Best answer by Fernando Amadoz 21 October 2022, 12:46

View original

9 replies

Userlevel 5
Badge +2

@abdi You should extended the CustomerLocation endpoint as those fields are not available in the OOB definition.

See in the following image the 2 fields being added at the bottom of the grid:

 

I am attaching a customization project that installs this extension in case you’d like to test it locally.

After that, you can refer to those fields in your PUT request:

 

Result

 

Userlevel 3
Badge

hi @Fernando Amadoz Thank you so much, in API url in params $filter what value should i fill in?

Userlevel 3
Badge

hi @Fernando Amadoz Thank you so much, in API url in params $filter what value should i fill in?

 

Userlevel 5
Badge +2

@abdi to insert/update records, in most cases you do not need to specify the filter parameter in the URL. It is indicated in the payload.

Acumatica identifies the record based on the primary key definition.

Example

PUT: http://[Instance]/entity/DefaultSetup/20.200.001/CustomerLocation

{
"Customer": {
"value": "AACUSTOMER"
},
"LocationID": {
"value": "1006"
},
"LocationName": {
"value": "TESTABC"
},
"AddressOverride": {
"value": "true"
},
"LocationContact": {
"Address": {
"AddressLine1": {
"value": "Line1"
},
"AddressLine2": {
"value": ""
},
"City": {
"value": "Cleveland"
},
"Country": {
"value": "US"
},
"Latitude": {
"value": "211"
},
"Longitude": {
"value": "322"
}

},
"DisplayName": {
"value": "DisplayName"
},
"Attention" : {
"value": "Attention"
}
}
}

For customer Location, the primary key is: Customer, LocationID.

If Acumatica does not identify this combination as created in the DB, then a new record will be created.

If the record does exist in the DB, then the specific values indicated are updated.

For instance, this reduced payload will update Latitude info only:

{
"Customer": {
"value": "AACUSTOMER"
},
"LocationID": {
"value": "1006"
},
"LocationContact": {
"Address": {
"Latitude": {
"value": "511"
}

},
}
}

 

Userlevel 3
Badge

hi @Fernando Amadoz I have tried but instead create a new customer location instead of updating, such as copying data from the customer and the latitude and longitude remains unfilled, I also tried to update the PostalCode field and the results did not change

 

 

 

 

 

 

Userlevel 5
Badge +2

@abdi 

Your payload looks correct.

I’d suggest testing it using a SalesDemo environment without customizations.

Userlevel 3
Badge

Hi @Fernando Amadoz is there any other solution?

Userlevel 5
Badge +2

@abdi 

Testing in a fresh demo environment would be my most immediate suggestion.

This will allow you to discard if it’s a customization or data issue.

Userlevel 5
Badge +2

@abdi 

Were you able to test it in a fresh environment?

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved