DEV Community

Cover image for Learn How You Can Take Advantage of the Appwrite API Without Using Any SDK
Eldad A. Fux
Eldad A. Fux

Posted on

Learn How You Can Take Advantage of the Appwrite API Without Using Any SDK

Appwrite is an open-source backend as a service platform that provides web, mobile, and native developers with a set of tools and APIs that aims to help them build applications a lot faster and in a more secure way.

Appwrite provides developers with multiple SDKs in various coding languages and platforms to help them easily integrate with the Appwrite REST API. In some cases, a developer might not want to use the Appwrite SDK, but to directly integrate his new app with Appwrite’s plain HTTP API.

This might be the result of multiple reasons. You might want to integrate with a new platform or coding language where no SDK is available yet, your project might be too small for using an SDK, or you might just want to do things your own way. Whatever reason it is, it’s OK. One of Appwrite’s main goals as a project is to be un-opinionated and allow developers the flexibility and freedom to do things their own way.

Client Authentication

The first step, for starting to send request, is to authenticate yourself vs. the Appwrite server. This can be done in two ways. In case you are integrating from a new client platform, all you need to do is to pass your project ID. This is done, by attaching your request the ‘X-Appwrite-Project’ header like this:

curl -XGET -H 'X-Appwrite-Project: [MY-PROJECT-ID]' -H "Content-type: application/json" 'https://appwrite.io/v1/locale'
Enter fullscreen mode Exit fullscreen mode

Once you have your project ID attached, you can start sending the request as your app user. By default, your user will be just a guest user with not a lot of privileges, but you could always use the Appwrite Account API to authenticate him or create a new user account.

Server Authentication

For server authentication, where you will have more scope permissions, you will also have to pass your API key. You can generate API keys from your Appwrite dashboard and choose which API permissions your app will need. Unlike with the client integration, when integrating from a server, you are not acting as your app user, but like an admin, who has access to all resources on the server project and is not limited to a specific user scope.

Once you get your API Key, pass it with Appwrite’s ‘X-Appwrite-Key’ header like in the following example:

curl -XGET -H 'X-Appwrite-Project: [MY-PROJECT-ID]' -H 'X-Appwrite-key: [MY-API-KEY]' -H "Content-type: application/json" 'https://appwrite.io/v1/users'
Enter fullscreen mode Exit fullscreen mode

Setting Localisation

Another option available, is to set an Appwrite header to change your API locale. This option is helpful when you need your response type in a different language or locale. As of writing, the Appwrite API has support for 46 different locales, and this number is constantly growing.

You can use the locale service to get different responses from the Appwrite’s Locale API, or even if you just want the welcome, verification, or invite emails sent to your users in a different language from the default English.

Starts Sending API Calls

Now, when you can both authenticate and change your Appwrite server locale, you can start sending requests to any of the Appwrite API’s as documented in the REST API specification. You are only limited by your current user permission and read/write access to the different Appwrite resources on your project, or by the permission scopes of your API Key that you defined in the Appwrite dashboard.

Learn More

Appwrite is an open-source project that is driven by its community. You can learn more about Appwrite features, API, and integration by visiting Appwrite official website or Github repository. You can also follow Appwrite news and announcements on our Twitter or Facebook accounts. You can also chat with us on our Discord server.

About Me

I am Eldad Fux, an Entrepreneur, Software Architect, open-source enthusiastic, and the creator of appwrite.io. You can follow me on my Twitter account: https://twitter.com/eldadfux or connect with me via Linkedin: https://www.linkedin.com/in/eldadfux/.

Top comments (0)