Build an app
In this article:
- Become a haravan Partner and create your Dev Shop
- Create your app
- Install your app into your Dev Shop and generate your API Key
- Check the requests and responses
- Interpreting the API documentation - how do I do **x** with the **y** API?
Become a haravan Partner and create your Dev Shop
To start developing your app, you need to become a haravan Partner by registering here for your free haravan Partner account. As a haravan Partner, you gain access to the Partners dashboard where you can create Dev Shops. Dev Shops are an area for app development where you can create data to test out the functionality of your app. To create a Dev Shop, navigate to the "Dev Shops" tab and click Create a new Development Shop.
Dev Shops share similar functionality to a real haravan shop and are capable of:
- Making unlimited purchases through the "bogus" gateway,
- Making 10 purchases through the real gateway,
- Having stock keeping units (SKU)s, a code to identify unique products, of up to 100 and
- Storing data, including html and css, in a disk block of 1GB.
Once your development process is complete you have the option of switching your Dev Shop into one of haravan's paid plans so you can start earning money from your store. To do this, click on the Switch to paid plan button in your Partners dashboard. Once you enter your payment details, haravan will move your Dev Shop to the Affiliates tab and your shop will now function as an Affiliate shop.
If you are already creating a shop for a haravan store owner (also known as an affiliate), you can follow the steps above to turn your Dev Shop into an Affiliate. The shop will then appear on the Affiliates page.
Once you have your shop created, your next step is to create your app.
Create your app
To create your app, login to your Partners dashboard. Select the "Apps" tab and click the Create app button.
The apps you create in your Partners dashboard function as public apps. You also have the option of developing private apps. Private apps have the exact same functionality as public apps except for one thing; they are locked to one store. This means that only one store will ever have access to this app. If you would like to learn how to use the API to create and generate a private app, visit this tutorial: Creating a Private App.
Once you have clicked on the Create app button you will be required to fill out a form. This form will set up the basic information to create your app and generate your API.
Planning to submit your app to the haravan App store? Take a look at our guidelines to see what we're looking for before you get started.
Install your app into your Dev Shop and generate your API Key
haravan's API implements JSON to manipulate each API resource in isolation, providing a RESTful interface. All API usage happens through haravan apps created by either store owners for their own shops, or by haravan Partners for use by store owners.
Any haravan app that you create will use the haravan API to access another shop's data and automate almost any action from their shop admin dashboard. When a shop installs your app, all they're really doing is giving your app permission to access their shop's data through the API.
To properly install your app, you will need to provide your app with an authentication mechanism. Authentication mechanisms allow your app to interact with other haravan stores. haravan uses OAuth 2.0 as its primary authentication mechanism but many of our developers and haravan advocates also have authentication mechanisms (typically referred to as gems, connectors or adapters) available through software development kits (SDK). These SDKs are available in several programming languages. Take a look at our Libraries to see what is available in your preferred programming language. You will need to authenticate your app to install it in your Dev Shop.
Once you have finished filling out the "Create new app" form and created your application, you will notice that your app has been provided with an API key. Treat all of your API keys like you treat the password to your shop admin. With an API key and password, anyone can access and modify the contents of your shop.
Check the requests and responses
Interpreting the API documentation - how do I do **x** with the **y** API?
Our API documentation is generated programatically, meaning that the API docs are kept accurate and up to date. Everything that can be done via the API will be reflected in the documentation.
The API docs accurately reflect which properties can be changed via the API. To find out which values can be included when creating or updating a object via the API, check the documentation. There are examples reflecting all possible ways to interact with that object.
For example, let's look at the Collect API documentation. We can see that it's possible to create and remove a Collect, but not update one. However, if we look at the examples for updating a Product Variant, we can see that there are a couple different ways that a Product Variant can be updated.
Similarly, the API docs will accurately describe what query parameters are allowed when looking up objects via an API.
In experimenting with the API, you may find undocumented behaviour. While this may allow you to fix problems that are difficult or not possible to solve otherwise, be aware that this behaviour is also untested, and may not work as expected.