Get Started with Wrike’s API

Mostrato in alto

The goal of this post is to show the easiest way to start using Wrike’s API.

Things to Know Before You Start

The Wrike API uses HTTP requests to get, update, and create data in Wrike. Since data stored in Wrike is personal, all requests should have an Authorization header. All data passed via Wrike API is in JSON format.

Before getting started with Wrike API, you should be able to:

  • Make HTTP requests
  • Setup request headers
  • Parse JSON

Before Coding

Before you start coding, you need to set up a development environment for your programming language.

The next step is the creation of an application. An application is needed for you to go through the authorization process and obtain an authorization code, which allows you to get private user data. If you are a Wrike user, you can register your app from the ‘API Apps’ section of Apps & Integrations. Just enter the application name in the ‘App name’ field and click “Create new.” You will see the settings of your application.

Wrike API supports the OAuth2 protocol and permanent tokens for authorization. A permanent token is easy to use, but has some limitations. The biggest one is that your application will have the same permissions as your Wrike user, so you should be very careful when distributing your application to prevent data leaks.

To generate a token:

  1. Navigate to the ‘API apps’ section.
  2. Select the required application from the list.
  3. Click ‘Configure’.
  4. Click ‘Obtain token’ in the “Permanent access token” section.
  5. You will see a pop-up with a warning about using the permanent token, and after confirming, you will be able to copy and paste it into a secure storage (Wrike will not display it again). If your permanent token gets lost, you should generate a new one.

Why You Need a Permanent Token

In Wrike you store your personal data, and no one except you has access to this data. However, if you want to grant an application access to it, you must provide the application with access credentials. The easiest way to do this would be to use the permanent token. Permissions granted to the permanent token are equal to the permissions of the user who generates this token. The application sends an HTTP header with a permanent token to Wrike’s server to get data, while the server checks whether the user with this token has permission to access this data (task, folder, or contact). This is why you need to keep the permanent token in secret. If you suspect that someone has gained access to your data, you must revoke the permanent token and generate a new one. You can do this on the application’s configuration page.

Time to Code

In our example, we use nodejs. First, create a file called index.js, open it in your preferred editor and paste the following:

// as we need to make https requests we import 'https' module
var https = require('https');

// store permanent token
var permanent_token = 'your permanent token';

// prepare params for request:
var options = {
  agent: false
};

// host for request
options.hostname = 'www.wrike.com';

// Wrike API uses the https protocol so you need 443 port
options.port = 443;

// Wrike API allows use method param
options.method ='GET';

// Set up Authorization header using permanent token:
options.headers = { Authorization: 'bearer ' + permanent_token};

// set up API endpoint, suppose we want to get info about the user who
// generates tokens(see
// https://developers.wrike.com/documentation/api/methods/query-contacts)
options.path = '/api/v4/contacts?me=true';

//make HTTP request
var req = https.request(options, function(res) {
  var body = [];
  res.on('data', function(data) {

          //collect data from server
          body.push(data);
      })
      .on('end', function () {
          body = Buffer.concat(body);

          //parse data form server
          var user = JSON.parse(body.toString()).data[0];

          //print data
          printUserInfo(user);
      })
  }
);

function printUserInfo(user) {

  //print out   information about user who generates permanent   
  //token for this application to console
  console.log('name       -', user.firstName);
  console.log('last name  -', user.lastName);
  console.log('id         -', user.id);
  console.log('accountId  -', user.profiles[0].accountId);
}

req.end();

Leonid Community Team at Wrike Wrike Product Manager Conosci le straordinarie funzionalità di Wrike e le best practices

Leonid Wrike Team member Conosci le straordinarie funzionalità di Wrike e le best practices

6
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
9 commenti

Hello Bagulin,

Thanks for the article, i would like to hear , how to get started with API. i need to start from the basic, Could you help users like me ?

i mean we don't know anything about API. if you have any docs/articles,etc to started with API 

Thanks in advance.

BR

Ravi

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Hi Ravi, so excited to hear from someone getting started with API! I'm checking with the rest of the team to see if there's a particular resource they recommend for people who are beginning to learn about API. I'll let you know as soon as I hear back from them.

We plan to post a series of articles on this forum, which will explain some use-cases for what you can do with Wrike's API.

I also wanted to let you know that it's possible to use Wrike API even for simple requests which don't require additional coding. There are some free third-party tools, like Fiddler or Postman (the add-in for Chrome browser), which can help you craft basic requests.

Once familiar with API theory, I would personally recommend starting with Postman for Chrome. They have great docs, explaining how to use the tool for requests to the REST API. After learning the basics of Postman, you can start trying out some simple requests to the Wrike API. Please follow the steps I described in this post, but instead of coding, try sending HTTP requests via Postman (make sure to pass the Authorization header with your permanent token, as indicated in our help docs (Step 3).

For Wrike API specifics, we have a full guide covering supported methods, you can check it out on our Developer's Portal :)

Leonid Community Team at Wrike Wrike Product Manager Conosci le straordinarie funzionalità di Wrike e le best practices

Leonid Wrike Team member Conosci le straordinarie funzionalità di Wrike e le best practices

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Pavel M

Hi Ravi! I wanted to share a great resource with you, which was created by one of our API integration partners, Zapier: An Introduction to APIs. This is a tutorial for those who want to understand the basic concepts of the REST API and the main principles of working with it. Easy to read and step-by-step, hope it helps!

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Many thanks for this sample code! It is a lot of help in getting started with my Wrike integration effort!

 

2
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos
Avatar
Pavel M

Hi OnTy! We are glad that you found this post helpful! Please do not hesitate to share your own example of API usage on our API Community :)

3
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

I would love to. Do you think you could post a sample Java or C# app to get me started? I would be quite thankful.

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

I'll join onTy Toom on this one. Tiny C# sample would be greatly appreciated 🙂

0
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

 I'm new to Wrike but I'm trying to develop an easy to use API Client with C# on github, maybe it might be useful for other C# developers.

 

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Hello

 

This code sample was very useful, I'd like to request a sample using POST to add new data like a folder or task please.

 

Darryl

1
👍 Spot On 💡 Innovative Approach 💪 Stellar Advice ✅ Solved 🪄 Remove Kudos

Folllowing List for Post: Get Started with Wrike’s API
[this list is visible for admins and agents only]

Su
Didn’t find what you were looking for? Write new post