views:

278

answers:

3

I need to create a diagram to document a RESTFul API that build, which UML diagram should I use?

Thanks in advance,

+2  A: 

Sequence diagrams are a good start. But you're better off reading about the different types of diagrams to see what your boss/prof etc want.

AboutDev
I was thinking in using a communication diagram, but a sequence diagram also seems feasible.Thanks,
Hugo
A: 

It depends what you want to convey, but when showing an API the sequence diagram is my go to diagram.

Ry4an
Thanks for your comment =)
Hugo
A: 

A sequence diagram shows the dynamics of a system. So, if you want to show the flow of calls that will occur when clients call your API, then that's your choice.

A class diagram shows the structure of a system. So, if you want to show the method/function signatures of your API and how they are distributed across types, then this is what you should use.

Or you could use both to depict different views of your API.

CesarGon
Thanks for your comment =) I think a combination of both will be the winner =)
Hugo
You're welcome. In my experience, most function-oriented APIs are better documented as class diagrams, using classes as "modules" or "components" to arrange the functions in groups, and looking at the API functions as methods. That offers a better level of granulaity on the API than a dynamics-oriented diagram such a sequence diagram.
CesarGon