How can I find all the APIs of my website? [closed] - api

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
The lead developer abruptly left my company last week. The APIs weren't documented. So I'm scrabbling to discover what each one API is, and then document them in JIRA. We use Golang for our backend. I tried using Charles Proxy, Fiddler, JMeter, and Chromes inspector/network, but the APIs aren't displaying. I have technical limitations and I'd like to find all our APIs as soon as possible. One of my developers told me to download and install Goland. And instructed me to perform the following
"byte.*(okay|StatusOK|Successful)
and mux. and nomapi. to get the end points and those that are using it, not sure if all of them use mux and nomapi though
With goland you can jump to definitions easily very useful with not familiar code
And find usages"
Not sure what he meant by all of that.
Can someone point me in the right direction?

This really depends on what your developer used to create the APIs. Your best bet is to parse the source code rather than poke with tools like Chrome inspector. What you want to find is the router for the API handlers. The router is basically a structure that maps API endpoints (like /api/v1/login/) to Go functions that handle the calls (appropriately called handlers). But, unfortunately, depending on what framework/library was used and how the code was structured, this could be in a lot of very different places. So, while I cannot give you one definite answer, I can give you a few suggestions.
You are going to have to read Go code. No way around it. It is not that hard, so don't get scared.
There is a good chance that there is a file or multiple files called route.go or routes.go or router.go or something similar. If you find anything like that, look there first.
If you cannot find any routes, use Chrome inspector's network tab to see what API calls your front end makes, then grep the code for the endpoints. Say, if your front end makes an API call to http://api.domain.com/api/v1/accounts/, search the code for /accounts/ and for /api/v1/ and if that doesn't work for /api/. With any luck the second or third search might get you to the root router for the application and you will be able to trace it from there.
If you find some routes (or route handlers), but not all of them, look for the package name at the top of the file. If it is not main, and especially if it is called something like routes look for any place where this package is imported (just grep for the package name in all the files and ignore the package declaration itself).
Probably the most popular router library is gorilla mux. Check the code for any references to github.com/gorilla/mux in case it was used. If it was used, look for any code that has HandleFunc in it. These are going to be the routers. The same is true if no router library is used at all.
Good luck.

Related

Self-contained documentation for .NET projects - doxygen? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
The task
We'd like to maintain some developer's documentation for our .NET projects with the following criteria:
"Documents", ideally written in Markdown for providing information that's not closely related to a piece of code (like overview, FAQ).
Standard inline comments for code and API documentation. We do thus in form of standard inline (XML) comments on the classes/interfaces (primarily for IntelliSense support, secondarily for being able to generate an API reference) and would like to continue to do like that.
The documentation is contained in what it documents; e.g. if it's an overview of a solution then in the solution, if it's for a project then among the project's files, version controlled in the same way as the code (this is so the docs are close to what they document, so they are less prone for going out of date, and also this was docs are always "at hand").
Ability to auto-generate (from the CI server) a readable, compiled documentation for a whole project, including "documents" and inline comments for APIs.
An example
We've a project that's a component usable within a 3rd party system. For this project we have the following type of documentation:
Overview (what the project does, what are the aims)
Installation instructions
API documentation
Version history
We'd like to enable our developers and other developers to
- read this documentation from the project's source package and
- from a website.
Solutions we've looked at
Using a wiki (we tried Confluence): this is good for "document"-type of documentation (like overview or installation notes), but it lives independently from the project itself. It's another system to maintain and because it's not before one's eyes when doing development it can quickly go out of date. Also it's one more task to somehow integrate auto-generated API documentation into it.
Using Markdown files and storing them along the code: this is simple and documentation is always at hand and close to what it documents; however we somehow need to generate a publishable web package from these files and the source files' inline documentation.
So far doxygen looks like the solution capable of providing all these. Do you agree?
See "How to include custom files in doxygen".
Broadly speaking this is exactly what I am currently doing, and I'm using Doxygen.
However, I'm afraid I know nothing about .NET. The project I'm working on is a Java package, but includes API documentation extracted from the source, user guides, release records and things like deprecations.
The only thing out of our scope and in yours is Installation Guide, but that's really only because the developer only gets to read it after installation.
We have Jenkins CI building the document on every change.
The 'descriptive' text is all written in Markdown which Doxygen handles reasonably well.
Downsides: If you are familiar with the way Doxygen handles grouping of text for source code you may be confused that these commands don't work to group the blocks of text in Markdown. There are a few other specific oddities but you'll probably find most of them if you scan my own questions on the subject (here, here and here)
Upsides: (Things we've found useful that you've not mentioned)
We can also parse the 'doxygen' markup in the Java API to create a javadoc that IDE's such as Eclipse can use. This does mean we have to limit ourselves to javadoc-style command in the API docs but that's not a big limit.
We've included, under doxygen 'build switch', a manual for your developers on how to write the documentation for the manual (OK, this is slightly recursive!). This provides the recommended command subset to use, and whether (according to taste) you want people to use doxygen #subsection or Markdown ## for headings etc.
Hope that helps.
I'd suggest you try it; trialling a sample of each type of document section you need, to see if it will do the whole set of functions you need. Nothing more annoying documenting 90% then finding it won't do the last 10%.

How to use Go with LDAP protocol [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
How can I use Go to call and manage Ldap protocol directly? are there any packages? or must I use udp and tcp?
There is no LDAP library in the Go standard libraries, but a quick Google search reveals several you could try:
https://github.com/mmitton/ldap
https://github.com/tonnerre/go-ldap
This second one is actually a fork of the first one. On github you can always view the open issues, last update and forking network (https://github.com/mmitton/ldap/network) to get a pretty good sense of which library you should use when there is a lot of forking.
If you need a library for something omitted in the Go standard libraries there are several good places to look:
Always start with a quick Google search
Checkout: http://go-lang.cat-v.org/pure-go-libs / http://go-lang.cat-v.org/library-bindings
And: http://godoc.org/
And: http://code.google.com/p/go-wiki/wiki/Projects
If all of those fail you and you don't feel up to creating your own implementation, keep in mind you can always use cgo to call C code (such as one of the many C LDAP libraries for example) from Go.
Thought I should add my ten cents here. It is an old post, but here it is nonetheless
I used the https://github.com/mavricknz/ldap library after using the mmitton/ldap one as mentioned by voidlogic above. The problem with the mmitton lib is that it does not handle escape characters very well in the filter.
The test filter: (&(objectClass=user)(cn=wickd(bracketTest )))
Escaped Filter: (&(objectClass=user)(cn=wickd\28bracketTest \29))
The MMitton library just came back with a filter compile error even with the escaped filter. Loaded the Mavricknz lib and it worked. Even comes with EscapeFilter function! brilliance!
Anyhow... Thought I should post this for anyone that had the same struggle as I did :)
I started to write a helper library for building server software capable of speaking the LDAP protocol.
There are some usage samples included.
https://github.com/vjeantet/ldapserver
Additionally, for the server end of it, I wrote this package (in Go) a while ago:
https://github.com/bradleypeabody/godap
It's not a full LDAP server but works well for implementing authentication on top of another data source (something I have been unable to find any other project that addresses).
It does a lot of "manage Ldap protocol directly" :)
For a simple high-level ldap client, see go-ldap-client, go docs.
Most of the options on https://godoc.org/?q=ldap
are just forks of another one, most of them are too low level or too limited (e.g. do not return errors
which make it hard to troubleshoot issues).
If you want to provide LDAP based authentication on your web page, you may like the solution I created: go-ldapc is a LDAP Authentication Client Module, with only one API.
It's on github - sona-tar/go-ldapc.

Editing Prestashop themes and modules [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I started using Prestashop yesterday so I’m a total beginner, but I've got some questions.
Is there absolutely no API for this? I mean I found the wiki but it holds no good information.
I want to edit my theme completely, as I wish. Edit html, add/remove JavaScript, just being able to do what I want, but when I edit the tpl files in my active theme, NOTHING happens. The site remains exactly the same. Why is this, or where do I change it without hacking the core? Do I have to recompile these .tpl files in some way for the changes to take affect?
I also want to edit a lot of the modules to match my demands, but same here, if I edit their tpl files nothing seems to happen or rather I don’t want to hack the core, since I suppose these will be affected if I update the platform.
Where do I find my products page, I want to create a menu with a link to a page called products or something with an overview of the products available in my store.
I’m very confused, but I guess you just have to get through this, I’m used to developing in WordPress or without any CMS for that matter.
Did you clear the cache after editing your templates?
Prestashop uses caching system to speed up the shop loading, so empty the cache directory to compile the new templates
API and documentations are a completely different things.
The team has updated the documentation (no more wiki) which can be found at http://doc.prestashop.com/
You should also check out the forum (forum.prestashop.com), you can find a low of questions / answers there.
Unsure if topic is dead, but here we go anyway. Make sure you have the theme you are working on loaded to start. You'll find this under Back Office > Modules > Themes.
As previous posters have mentioned head to Back Office > Preferences > Performance and enable "Force compile" and disable "cache".
There is a bit if an API available, but in my opinion start from the bottom up mate, there is reasonable documentation (again, as mentioned above: http://doc.prestashop.com/) available that will at least give you some questions to start asking.
Just deleting the cache not worked for me. I had to delete /themes/<current_theme>/modules/<edited_module>/ directory.
you can disable cache Advanced Parameters >> Performance.
As mentioned the cache is an issue here so always clear it. Also you can completely structure the template system how you want it, even editing the controllers if need be. As this is MVC you have to think about the whole system when customising it.
Have a look into VQMOD, this allows you to have xml files that edit the controllers on the fly for added functinality i.e. added filters or product rollover images on the category page. VQMOD is perfect as then the core system can still be updated.

How to open-source an application that uses API keys [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
For a pet project, I develop a desktop application which requires API keys from several different webservices.
I've been going through and preparing this application to become open-sourced and run across the problem of what to do with those keys.
The problem is this: My understanding is that these API keys should not be visible to anyone using the application or viewing/modifying the source code. From the webservice's end, these API keys are used to identify applications accessing their API, and allow/block usage as appropriate. In most of the TOS's for receiving these keys it's actually explicitly stated that the keys must not be shared with the world.
Currently all my keys are hard-coded, but at I'm at an impasse as to how to handle the situation of private keys in an open-source application:
-If the keys remain hardcoded, they'll be publicly visible as soon as my source code is.
-I can't really omit the source file with the keys from the code distribution, since then
it won't compile. This technically solves the problem, but introduces a new, unacceptable
one.
-If I push the keys off to a .ini or other config file, and simply not include that file
in my public code repository, it would still have to be distributed with the binary of my application in order for the app to function, so my keys would be visible in the application distribution instead of the source distribution. Not an improvement. Any encryption gymnastics I attempted to utilize on this INI file would be adding the complexity for anyone attempting to modify my code.
So, with regards to my codebase (currently under Mercurial for version control), what's the best way to manage everything so that the code can be public, but my keys stay private?
Don't know what language you are using, but for example in C/C++ you'd add a include file with the API keys, and then leave it out of source control, instead add a bogus file with explicitly fake API keys. Most languages have one or the other way to include files.
Your app should use a config file. This config file is loaded at runtime and shouldn't affect compiling. The allows users to download a binary and still use their own api key.
As Kornel says, you can include an example config file with a fake API Key, in your source control.
Another option, you could talk to the people running the webservices and ask for one of two things.
A temporary key, that only works for limited functionality. That would let users see basic functionality of your app, but some people would never update the key and just use the basic stuff.
Talk to the webservices to see if you they will give you a special API Key for your application. The open source version would require users to enter their own. But your binary could use a standard one.
The thought of using a config for api key's, isn't new or unheard of. Bit.ly services do it. And all the open source applications I see that provide use with Bit.ly ask for your username and api key before you can use it.
This is no different?

Need to choose a suitable language to write documentation in [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Currently the documentation where I work is in a bit of a state. There isn't anywhere near enough of it, and the documentation that does exist is spread out over many word documents making it hard to find anything.
I'm trying to take some initiative and get it improved, and I figure the first thing is to find a better format to write the documentation in:
My thoughts are that the documentation should be structured in a series of short articles (MSDN / Html Help style) and structured in a suitable tree:
It would be good to be able to produce a standalone Html-Help style package to be shipped with the application
As well as being able to produce a MSDN-style website as a reference for those who are too lazy to look at the CD.
Search is of course a must-have
It needs to be at least reasonably easy to update - if there is a 17 step process to update the published documentation then it makes it seem like too much work to do simple changes, and nobody can ever be bothered to update it.
The documentation is technical in nature, and so ideally it would be nice to be able to include generated documentation from things like the Xml documentation embedded in C# code. This is however definitely a side-requirement - currently very little useful Xml documentation exists, its just that in the future I plan to fix that.
For the same reason it is often good to be able to handle things like attachments (code samples etc...) I'm not expecting anything fancy, but this is something I need to bear in mind to make sure that its at least not handled badly.
Are there any projects or languages that are suited to this sort of documentation?
I've had good results with doxygen on my C and C++ projects although it supports many other languages as well. You put the documentation in comments in the code that can be simple or complex HTML markup. It is very easy to update as it is part of the code. You can make building the documents part of your build process. Additional topic that are not strictly API related can be added as separate HTML documents. The version I'm using doesn't support search so you would have to add another product to search these pages. Because it is HTML you can add in code samples, diagrams, etc.
If you use LaTeX you can get all your documentation in great looking PDFs and printed copies, as well as being able to generate html (via latex2html). TeX has the advantage of being all plaintext, too, so you can track/merge it reliably with your favourite revision control system.
We use confluence as our documentation repository. It is fairly easy to have public and private sections, and has a nice WYSIWYG editor. It can handle attachments and can be saved off as PDF documents if you like.
I've used robohelp with good results. it is plain html, but has a generation process that keeps everthing looking consistent. It can be packaged as a .hlp file with the app, or published to the website. Check it out, it is simple so you can get back to doing your job :)
A clean way is to use DocBook. It is easy write and undetstand. It is also easy to parse as XML parsers are standard and other forms of documentation (e.g. from the embedded documentation in comments) can be easily be transformed to this format.
It is straightforward to generate PDF, HTML og other formats from the DocBook source (tools exist for this purpose).
I've started using DokuWiki. Its not exactly what I was originally looking for (I think I was really looking for a CMS), but it does the job and some respects its better than what I originally had in mind (in particular its a wiki - I've not yet gotten as far as publishing this to our customers however so I'm not sure how well thats going to work out)
I'm using the IndexMenu plugin and the Arctic template to get a navigation tree on the left, and if I publish the wiki itself I'll use the discussion plugin to allow users to post feedback.
Currently my method of handling generated content is to use xslt templates to produce dokuwiki syntax, and write that output directrly to files / folders in the "data/pages" folder.