Inside Office 365's APIs

Office 365's APIs are crucial to Microsoft's cloud strategy. Here's a quick primer on how to take advantage of them

development tools toolbox cloud wrench hammer fix
Shutterstock

Last year Microsoft CEO Satya Nadella said that the Office 365’s APIs were the company’s most strategic -- and most valuable.

Designed to open Microsoft’s cloud productivity platform to developers, Office 365 APIs are collections of tools that simplify building Office’s cloud services into your apps. Microsoft’s cloud services are at the heart of its current strategy, and its APIs are a big part of how it delivers those services to everything from Android phones to Node.js Web applications. 

Using familiar REST APIs, and providing SDKs for common platforms, Microsoft is aiming to use Office 365 and Azure Active Directory as hubs where apps store files and users build collaborative relationships with others.

The underlying technologies Microsoft is using will be familiar to anyone building a modern app that connects to Web services. REST and OData are used to transfer data, while OAuth 2.0 is used for authentication. Drilling down into the APIs, you can start to see how Microsoft is exposing Office 365 to apps. Take email, for example. The structure of a call is based around a root URL that’s made up of a server name, the API version being used, and the user context.

Once you’ve constructed the appropriate root URL, you can start to make calls against the API. If you want to get the inbox messages for the logged-in user, just append “messages” to the root URL. For other folders, you’ll need the folder ID. The response can be large, as it contains details for all the messages in the folder, including content and a full set of headers. Perhaps the most useful element of this response is the message ID, which can be used in further calls to the API – including to obtain the full message, and even to download attachments.

Sending messages is a lot easier. You’ll need to create JSON content for the API call, which uses an HTTP post to the root URL’s sendmail method. You can create and send messages instantly or add a draft to a folder, which can then be updated and sent. Other options let you create and manage replies, forward messages, and delete messages from folders. Working with Office 365’s mail service is a lot like working with a database -- complete with the familiar CRUD (Create, Read, Update, and Delete) operations.

To continue reading this article register now

How to choose a low-code development platform