Add new task error


#1

Hello, I get an error "This hapikey (.....................) does not have proper permissions ! (requires all of [content-access])". I use RestSharp creating my request.

        var client = new RestClient("https://api.hubapi.com/");
        var request = new RestRequest("calendar/v1/events/task", Method.POST);
        request.AddQueryParameter("hapikey", hapiKey);
        request.RequestFormat = DataFormat.Json;

        request.AddBody(new
        {
            properties = new[] {
                new { property = "eventDate", value = DateTime.UtcNow.ToString() },
                new { property = "category", value = "TEST"},
                new { property = "state", value = "TODO"},
                new { property = "campaignGuid", value = Guid.NewGuid().ToString() },
                new { property= "name", value= "Task Name" },
                new { property = "description", value = "Task Description" }
                //new { property = "ownerId", value = "" },
            }

        });

        IRestResponse response = client.Execute(request);

#2

Hi @Nicolas_Ppelis,

This error usually means one of two things:

  1. You're using the wrong hapikey; occasionally folks will create a developer portal and grab the developer hapikey, then try to use that to make requests to their Marketing/CRM portal. To make requests to your Marketing/CRM portal, you have to use that portal's hapikey: https://knowledge.hubspot.com/articles/kcs_article/integrations/how-do-i-get-my-hubspot-api-key
  2. Your portal doesn't have access to the tools that correspond to the API you're trying to access. A common example is a user with a Marketing Free portal trying to make a request to the Content APIs. If this were the case, it'd be that your current product tier doesn't have access to the Calendar API.

I can't say for sure exactly which reason is causing the error for you, but I can dig into this further if you send me your Hub ID!