CodingJungle Posted May 13, 2021 Posted May 13, 2021 my request: can we get documentation for adding API to our apps, I'm having to add it to 3 different apps atm for a project for a client, and i'm really sorta winging it. looking at what you guys have done, but even then its not all that clear what is being done or why. please document the graphql api you've added, i'm assuming you are using this in your mobile app, since i can't find any reference to it in any of your php/js code. '/^\s*\*\s*@([a-z]*)(\t+([^\t]*))?(\t+([^\t]*))?(\t+([^\t]*))?$/', found in /system/Api/Controller.php line 319. hopefully I can express how much misery this regex has caused me. you guys are literally the only software or framework i know of, in php or not, that uses tabs in their code. I use spaces, the rest of the world uses spaces, I have git hooks that will actually reject code for using tabs instead of spaces, my IDE is configured to use spaces. so for like .00001% of the over all app, on stuff that isn't even code, i have to undo ALL of that, just so the api reference docs are processed and shown in the ACP for the other devs on this project to have easy access to that info. I spent a good long while trying to figure out why it was not showing or throwing an exception in the api references, as there was no clear indication as to what was causing it or why. so for sanity sake, please make this regex more robust to look for tabs or space (or better yet, not rely on phpdoc block for api reference, make it a json/xml/txt in <app>/data that can be read and parsed out). $this->_respond( json_encode( $output, JSON_PRETTY_PRINT ), $response->httpCode, NULL, $shouldLog, TRUE ); /system/Dispatcher/Api.php line 338/342/348., this code does not always produce valid json. it looks like json, but its not, its corrupted. I've had to add 'JSON_HEX_QUOT | JSON_HEX_TAG ' to the flags section of json_encode to get it to produce valid json (i did this thru a hook, but had to overload the entire method, cause there was no point in the code execution, i would be able to add those 2 flags). So please either add those flags or move the json_encode to a method inside the dispatcher, where all it does is json_encode, that way i can hook it and add those flags or any other flags i might need in the near future. editor content from the api doesn't not get the file or url place holders replaced, i was pulling articles and blogs records, and none of the internal links or attachments were showing up, cause they still had the <___base_url___> and <filestore> stuff still in them, so i had to go hook blogs and articles api to parse them (haven't gotten to the other apps yet). embed/iframe content also is not loaded, cause the src attribute is empty, as the source is still on data-embed-src (i'm assuming this is apart of the IPS lazy loading that didn't get scrubbed properly). on db records, you include a title property but in 'fields' property, it also includes the title field content as well, so if that can be removed or at least give us the ID of which field_# is the title, same for description. can you also include for any dates, a rfc2822 format along with the rfc3339, as javascript does not like the rfc3339 one (example: DateTime::ts($sometimestamp)->format(RFC::882), this will return a rfc2822 formatted date). heck even a raw unix timestamp would be better than a rfc3339 :). to be completely honest, the api has not been a pleasure to write code for or to work with. it is one of the most difficult API's i've used. I have spent about 20 times longer debugging and finding solutions, than i have actually writing code to use the api. any way, i hope you guys can address these issues, if not, I might be forced to abandon the api and find another solution. Ilya Hoilik, BomAle and Jon Erickson 2 1
Recommended Posts