Question:
I have a Rest API where I’m exposing my own Booking Application. I have a function called addBooking. The source application collects information regarding Booking. Then a rest API call is made from the source application to my Site.
The issue I’m facing is that because the data hasn’t been collected using WIX Address Input field I need to using the WixData.Insert to add the Address info into a WIX CRM Table.
Does anyone have a working example of using the WIXData.Insert to insert a valid Address.
Each time I try when I go to the CRM it says it’s not a valid Address.
I’m inserting the address data in as a comma delimited string eg:
Thank you but I’m not sure this answers my question. I really need to know the format that will be accepted by Wix Insert into a CRM Address field.
I’ve tried various formatted strings but nothing seems to be accepted.
I could really do with a working example of code for inserting into a CRM table. The value hasn’t come from an address input field, rather from a third party application with a number of fields collecting data related an address.
{"subdivisions":[{"code":"NY","name":"New York","type":"ADMINISTRATIVE_AREA_LEVEL_1"},{"code":"New York County","name":"New York County","type":"ADMINISTRATIVE_AREA_LEVEL_2"},{"code":"New York","name":"New York","type":"ADMINISTRATIVE_AREA_LEVEL_3"},{"code":"US","name":"United States","type":"COUNTRY"}],"city":"New York","location":{"latitude":40.7391801,"longitude":-74.0091214},"countryFullname":"United States","streetAddress":{"number":"100","name":"Gansevoort Street","apt":"","formattedAddressLine":"100 Gansevoort St"},"formatted":"100 Gansevoort Street, New York, NY 10014, USA","country":"US","postalCode":"10014-1477","subdivision":"NY"}
This is why I pointed you to the address input documentation. I know you are NOT using an address input but getting that data from elsewhere, but what I suggested was to see the format that the Address Input uses and try to parse your text into the same format before entering it into your CMS.
Which is why it is always recommended to search on the forum first for similar questions before posting your own. Chances are somebody has already faced the same issue before you and has found a working solution to it. All you need to do is to research thoroughly first.
The solution above seems to format the object into a valid address using an external API. If straightforward text-to-object parsing isn’t working, then you can take some inspiration from this one and customize it to fit your needs.