Update BO from smartphone Android

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
fjcortes
Posts: 72
Joined: Thu Apr 21, 2011 9:16 pm
Location: Colombia
Contact:

Re: Update BO from smartphone Android

Post by fjcortes »

Hi Jaymer,
Again, I tried to use postman, but I think I don't understand how this tool works or I lack knowledge in the subject.
On the other hand I created the structures and tried to send this information through this URL:
http: // localhost: 8080 / AwareIM / REST / pdv / sendme? PostedNY = 1 & response = {"response": [{"Qkey": "2000798-1"}, {"Qkey": "2000798-2", " Qans1 ":" 111 "}, {" Qkey ":" 2000798-4 "," Qans1 ":% 20" 222 "},% 20 {" Qkey ":" 2000798-5 "," Qans1 ":" 333 " , "Qans2": "serial_number"}, {"Qkey": "2000798-6", "Qans1": "444"}, {"Qkey": "2000798-7", "Qans1": "555"}, {"Qkey": "2000798-8", "Qans1": "666"}]} & theTime = "2019-10-08 12:00:00"

but it sends me an ERROR 400 when I put it in the browser, in postman it sends me a 500 error.
I think I will try to send the invoices one by one for a simple url.

Thank you for your invaluable help.
Javier Cortes Ayus
Version 9.x (Testing)
OS: Ubuntu 20.04.6 LTS - DB: MySQL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Update BO from smartphone Android

Post by Jaymer »

You can’t send it through the URL like that.

Read this
https://stackoverflow.com/questions/389 ... ebservices

The question is not important, but the two replies show you how.
That should tell you how to get your JSON structure into postman.
Then you click post or send, and it will go to aware and you should get a response.
You should work back-and-forth like that until your JSON data is getting posted into the database.
After that, you can now go backwards to the phone part, or go forward to the aware processing part
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
fjcortes
Posts: 72
Joined: Thu Apr 21, 2011 9:16 pm
Location: Colombia
Contact:

Re: Update BO from smartphone Android

Post by fjcortes »

Bingo!!
Following these instructions, it works on the structures, I created a procedure that receives the header structure as input and returns a BO with code 00 if it received data or code 01 if the structure is empty.
But .. I realized that the values of the attributes do not save them, I only create each of the records and the attributes leave them with a NULL value.
I did all this through postman
Javier Cortes Ayus
Version 9.x (Testing)
OS: Ubuntu 20.04.6 LTS - DB: MySQL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Update BO from smartphone Android

Post by Jaymer »

possibly related to your BOs - thats why up above I gave you pics of how the BOs needed to be to receive that JSON.

send me the exact JSON from Postman.
Send me pics of your header BO, and child BO (if you have it yet)

Its quite possible for Aware to receive the request, and apparently send you an OK response, but not write the data to the db if your BO structure is not perfect.
this is all the big "trick" to implementing REST. Aware implemented a "Discover" feature in 8.3, but it only works to an online service. So if you were calling a "real" service (ie. not just your custom phone app) THEN Aware could build the BOs to properly receive the JSON. But for now, a simple error in your BOs can make the data not get saved.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
fjcortes
Posts: 72
Joined: Thu Apr 21, 2011 9:16 pm
Location: Colombia
Contact:

Re: Update BO from smartphone Android

Post by fjcortes »

ok, since it is clear how the POST is done to AwareIM for uploading parent and child files. I had been delayed by the names of the attributes, because I did not take into account the capital letters, but once I made the corrections I charge and fill all the attributes correctly as seen in the image.
Image

now thanks to postman, I can use the java code to load from the cell phone
thank you very much Jaymer, for so much patience and the knowledge provided
Javier Cortes Ayus
Version 9.x (Testing)
OS: Ubuntu 20.04.6 LTS - DB: MySQL
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Update BO from smartphone Android

Post by Jaymer »

Sweet

Ok so the names of the BOs don’t really matter. You can change to Rest_header & Rest_detail, for example.
You just change the Input BO on the Service Process to match your Header BO name.
You can add other JSON fields at the top level (not inside the [ .... ] child array) plus any other child fields (in the array) as long as you match field names.

No problem with having extra fields in Aware table that are not in the JSON.
But you’ll get an error If your incoming JSON specifies an incorrect field name. (the 500s you were getting)

Much easier, as you’re finding, to test with postman!
the major pain is that you have to publish after each little tweak.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply