Hello EveryOne,
i have a question about Json Data Format when dealing with API, there’s a little discussion between PHP as backend and Ionic for frontend how json data format should be. at least must be {}, or [{},{}] or even [{},{},[{},{},{}],{}]
as what i have learnt, json data format for GET at least minimum must have USER ID or an ID for a specific user’s datas for orders, addresses or information so that when ionic side here request for GET is based by ID.
very experienced and skilled PHP backend programmers did the sorting and arranging of the MYSQL database themselves inside their PHP framework backend and provide API endpoint without User ID for specific ID for GET Address, Orders and causing me some confusion how json data format should be?
shouldn’t it just be PURE? no auto arranging in backend? just pure GET and POST without other conditions?
i would like to humbly learn and listen to everyone for your opinion and pinpoints as my experience is very shallow.
thank you

My 2cents - JSON format specification does not guide much about the content of the data, just the syntax. So the JSON specification is not likely to be a judge in this.
All formats you show seem to me valid JSON. Whether it contains or not upfront userdata.
The guiding principle I like is that the API should cater for proper response times in the front end. So if the data is organised in a way the front end needs to process a lot, creating bad response times (user has to wait - due to multiple requests, etc), high bandwidth usage and battery drain, then the API is not really suitable for your users.
All other things more seem like which developer has to do the most work to get stuff done. That is a management call. If you get paid by the hour and they don’t, then maybe take the job!
Interestingly, SQL driven people like to create database and query structured optimised for storage and normalised data. If you build for fast response times, you actually should want the opposite and create redundancy in data. That is the interesting fight you are facing. Optimise for read or for write?
hi, thank you for the reply, i will watch the youtube shortly.
currently, the discussion its about READ/GET, how am i able to GET/READ from API without User Id or Product ID.
i shut down my computer for a day as felt a bit ‘jammed’ in my little brain about thinking, they worried about system being hacked, so the endpoint should not reveal any id or anything. has to be very specific, once token is send to PHP system will send me data based on the token.
i suggested to send me json data as index and i can filter inside typescript based on USER ID but they worried about too much data load at 1 time which can result to IONIC become slow??? if JSON DATA is just [{}] or {} or [{},{},[{},{}],{}] that’s just beginners level, API should be more complexed that just like that…, i thought standard GET and POST of json data i thought its supposed to be straightforward
They mentioned IONIC vulnerable to hackers, as Users/hackers can accessed the apk files via rooted phones to see the endpoint and hacked the backend? They are very experienced PHP programmers so they have their stuff to consider too.
regards.
I frankly am lost here. Lots of non-technical questions one can ask about your situation. Outside of my appetite.
If they feel like sending more data then needed, and you worry about your endpoint performance, then you could consider putting your own server in between.
Endpoints like phones and PCs are indeed inherently unsafe in many ways. So that is something you need to take into account designing your architecture.
ya, you are right, its more about non technical questions with lots of possibilities about JSON DATA answers.

there will be a few technical questions soon which i am waiting what the READ/GET json data i am going to get to solve the puzzles.
thank you for your reply and have a great day!!! Tommertom
