Skip to main content
Question

Custom Action with Clio Returning 502 Bad Gateway Error


Hi there, I am trying to create a Custom Action that makes an API call to Clio to obtain only specific fields from a specific matter. I cannot use the API Request (Beta) action because of a current 401 error bug. When I test my action, I am getting a 502 Bad Gateway error code. I have tried to add in debugging/logging and cannot figure out what exactly is going on. In Postman I have been able to do the OAuth2 handshake and obtain the matter; I fear the action is not doing the handshake correctly? Not entirely sure.

 

Right now, I am just trying to simply get the matter. I have tried using headers including Content and Authorization but still no result.

export async function getMatterDetails({ matterId }: { matterId: number }): Promise<{ result: any }> {
  // Construct the URL with the matter ID
  const url = new URL(`https://app.clio.com/api/v4/matters/${matterId}.json`);

  // Make the API request using fetchWithZapier
  const response = await fetchWithZapier(url.toString(), {
  method: 'GET'}
});


  // Use throwErrorIfNotOk to handle non-OK responses
  await response.throwErrorIfNotOk();

  // Parse the JSON response
  const data = await response.json();

  // Return the result
  return { result: data };
}

 

Any help/guidance is appreciated. 

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.