There are few ways to communicate with SharePoint API which includes :
SSOM – Server-side object model, this approach is used when your code sits on the SharePoint farm and communicate directly with SharePoint classes compiled on the farm servers GAC. You can use SSOM when creating custom web part with VS and C#. SSOM will give you the best performance since there is no round trip across client and server, and it also provide the riches set of classes. This approach is also with the higher risk to damage farm performances due to bad coding. today’s approach is leaning toward client side programming which has its own limitation and drawbacks.
CSOM – Client-side object model. code that communicate remotely with web service based API, using C# or VB, with CSOM assembly such as Microsoft.SharePoint.Client.dll.
REST- OData ( Open Data Protocol ), enable to send queries directly from the URL.