UML Diagram to Model API

31,730

Solution 1

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.

Solution 2

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.

Solution 3

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

Share:
31,730
Hugo
Author by

Hugo

Wannabe Hacker, I love programming.

Updated on July 14, 2022

Comments

  • Hugo
    Hugo almost 2 years

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

    Thanks in advance,

  • Hugo
    Hugo over 14 years
    I was thinking in using a communication diagram, but a sequence diagram also seems feasible. Thanks,
  • Hugo
    Hugo over 14 years
    Thanks for your comment =) I think a combination of both will be the winner =)
  • CesarGon
    CesarGon over 14 years
    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.