What points should I consider in order to create an API for the new website that I am creating?

What points should I consider when creating a site and planning for user support for the API?

I see that most well-known websites provide developers with APIs for working, for example facebook, twitter, google, ....

Are there any common points that I should consider when creating a new website in order to be able to support API developers? "just very general points, regardless of whether the site works independently"

UPDATE all the answers below helped me a lot.

+4
source share
6 answers

I recommend the optional PDF and presentation of Joshua Bloch, "How to Build a Good API and Why It Matters."

+2
source

Soap or XML

Depending on your application. If this is difficult, you may need soap functionality. KISS should be used with the API. Have a reasonable url that makes sense in terms of resources:

www.site.com/people/london 

As a resource.

http://en.wikipedia.org/wiki/Restful

See why it is important to use PUT, POST, GET and others.

Luck

+3
source

I assume that you will start by defining the functions (e.g. addUser, addStory, addComment, editXYZ, etc., depending on the type of site) that are supported by websites and the data that it provides (getCommentsForStory, getStories, getUser , ...) and the creation of web services APIs for these functions with appropriate security checks, etc.

If you have well coded a website, placing a web service level in front of your website should be fairly simple (this is just another view on top of your controller and model).

+2
source

The most convincing reason IMO to provide an API is that your site provides information and / or services that people will motivate to interact with the software. Since you cannot prevent it (despite the many hopes and dreams of site owners), it’s better to cover it, because providing an API means that people can get access to exactly the information / services that they need, reducing the load on your systems.

+2
source

One simple thing that can save you a lot of trouble in the future is to include an “API version” as part of your URL, something like.

 www.example.com/api/v1/getAnswers/ 

If and when you decide to revise your API, you don’t need to worry that your URL is backward compatible (breaking existing applications), your users just start using /api/v2/ and eventually depreciate the old version.

Among others, del.icio.us and github both do it.

+1
source

Creating a good api is hard and requires a lot of practice.

The first api you create should be the api of your adversary website.

second api for your friend website.

The third api you create is for your customers.

0
source

Source: https://habr.com/ru/post/1285738/


All Articles