List Tickets - You have to be logged in to perform this action

As part of a custom installation, I want to update the all existing tickets, so I am starting by attempting to list all existing tickets, using the invokeTemplate method. However, I get an invalid credential error if I include the query string ?updated_since=2015-02-19T02:00:00Z as per example. If I omit this query, I do not get any error, and I can make the call using the standard API and other calls with the
same authorization string.

Call

        THIS.client.request.invokeTemplate("getTickets",{
            context:{
              domain: THIS.domain,
              api_key: THIS.apikey,
              per_page: freshdesk_page_size,
              page: page,
              query:query
            }
          }
        ).then(

Relevant section from requests.json

    "getTickets":{
        "schema":{
            "protocol":"https",
            "method":"GET",
            "host":"<%= context.domain %>",
            "path":"/api/v2/tickets?per_page=<%= context.per_page %>&page=<%= context.page %>&<%= context.query %>",  
            "headers": {
                "Authorization": "Basic <%= encode(context.api_key) %>",
                "Content-Type": "application/json"
              }
        }
    },

I’ve attached screen shots of the request send to the server and the response received.


If I remember correctly the API key can only be used at runtime from the secure params. It cannot be passed in the context. Exception for that is on the installation page I believe

Sorry, my previous comment was wrong. You can actually use API key from the context it seems. Your problem might be connected to the query. You need to pass that as a separate parameter in the schema. Here is an example how I used it with agents:

"getAgents": {
    "schema": {
      "protocol": "https",
      "method": "GET",
      "host": "<%= iparam.freshdeskDomain %>.freshdesk.com",
      "path": "/api/v2/agents",
      "query": {
        "page": "<%= context.page %>",
        "per_page": "100"
      },
      "headers": {
        "Authorization": "Basic <%= encode(iparam.apiKey) %>",
        "Content-Type": "application/json"
      }
    }
  }

Hey @DaveWP,

The ISO datetime strings work in production, so if you fdk pack and then publish as a custom app it should work as expected. We noticed a small fix on fdk, thanks for bringing this to our notice.