How do I create an API for my website?

M

musosdev

Hi guys

Bit of a generalist question, but I'm using ASP.net as my development
platform.

Basically, I have a website (an independent music store) and as well as the
normal functionality, I'd like to build in an API, so that other sites
(either asp.net or not) can query our data and get results back.

Simple question... where do I start?! Can anyone point me in the direction
of a "how to" (either technical or an overview of how an API should work).
It's something I've not explored before, so I haven't a clue.

Any help appreciated!


Dan
 
J

John Saunders

musosdev said:
Hi guys

Bit of a generalist question, but I'm using ASP.net as my development
platform.

Basically, I have a website (an independent music store) and as well as
the
normal functionality, I'd like to build in an API, so that other sites
(either asp.net or not) can query our data and get results back.

Simple question... where do I start?! Can anyone point me in the direction
of a "how to" (either technical or an overview of how an API should work).
It's something I've not explored before, so I haven't a clue.

I find it useful to think about how the API will be used. In order to do
this, I use the UML Use Case diagram. I model one Actor shape for each kind
of entity that might want to access the API, then create use case shapes and
connect the actors to the use cases they use. As analysis continues, I find
common pieces of functionality that are shared amongst use cases. A login
function will be common between "update stock" and "list available music"
use cases. I connect these to the main use cases through Include connectors.

When I've done with this, I find a certain number of use cases that are
directly accessed by actors, and a certain number that are only used by
other use cases. The ones that are directly accessed by actors are your API.

In terms of a web service (which I recommend you create), these are the
operations in your contracts.

You may find sets of use cases that seem to belong together. For instance,
one actor may reference one set that the others never reference. This would
indicate you should split the functionality into two services, one for the
one actor and another for the others.

I don't know if that helps you, but it works for me.
 
H

Hillbilly

Web Services are widely used to expose methods and properties other
developers can use to access your data. Microsoft has some webcasts I once
started viewing that provide guidance on writing the classes for an API but
you'll have to do the work to find the series of 3-4 as I recall.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top