I'm working on a project where I would like to cross-reference to api.drupal.org for tagging items with core functions used and providing links back to api.drupal.org to display the official reference material. However, it doesn't appear that the URL naming scheme is easily predicted (e.g. instead of being able to request something simple like https://api.drupal.org/hook_menu/7 the live URL is https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...).
With the rollout of the public API for d.o documented at https://www.drupal.org/api it'd be nice to have something similar to query api.drupal.org for function info. I could see this not only being useful for a project like mine, but for IDEs to be able to easily provide contextual function references, issue queue input filters, etc.
If there is something out there already that can do this - where is it?
If not - what would it take to get involved to provide a service like that on api.drupal.org?
Thanks!
Comments
Comment #1
drummhttps://api.drupal.org/hook_menu is the most simple redirect, if you are okay with always linking to the current version's documentation.
Comment #2
arpieb CreditAttribution: arpieb commentedThanks for the snappy reply! That would work great for linking to the API site, didn't try that one. Derp.
Along those lines - any way to get a list of all core hooks for a given version of Drupal out of api.drupal.org? Or am I just going to need to suss those out of the codebase?
Comment #3
drummThere is https://api.drupal.org/api/function_dump/7. I think that follows the format of something the PHP documentation provided, that I don't know the status of.
Comment #4
jhodgdonThis seems like it should be in the API module not in this project. Sorry I didn't see this before.
So... The existing pages that you can use on any API site to get lists of things:
a) (site)api/function_dump/(branch) -- for example, https://api.drupal.org/api/function_dump/7 -- this is not all that great.
b) api/(project)/full_list/(branch)?limit=M&page=N -- for example, https://api.drupal.org/api/drupal/full_list/7?limit=20&page=0 -- This gives a paged list of all documentation objects in JSON format.
Hopefully one of these will satisfy your use case. If not, can you give more details of what you would need?
Comment #5
arpieb CreditAttribution: arpieb commentedThanks to both of you for that information, I believe I have everything I need. If not, I'll re-open this issue. I didn't realize the API site was using the actual API module, so apologize for not opening this in the correct place. Duly noted going forward!
Comment #6
jhodgdonGreat, not a problem! Just explaining why I didn't see and respond earlier. I wasn't subscribed to the apidrupalorg project issues (I am now).
Anyway, yeah, the main purpose of the API module is to produce api.drupal.org, although there are a lot of other sites out there that use it for similar purposes for their particular contrib project, like Drush for instance has a site.