Troubleshooting API Requests

Troubleshooting API Requests

Last Updated On November 10, 2019

While using the API Connector add-on for Google Sheets, there may be cases where your API request doesn’t work, or returns an error message. This article will describe some known issues and ways to troubleshoot issues with your API requests.

❓As a general tip, you can also try running your request with a tool like Swagger Inspector to help identify whether the issue lies with API Connector settings or with the API request itself.

Authorization Errors

Make sure you’ve entered any required authorization credentials into the Headers table, and that you’ve encoded them to Base 64 if required.

Error Messages

Pay attention to any error details as they will alert you to specific fields that need to be addressed. This article on Error Messages provides more details on each message.

Incorrect Content-Type

When making POST requests, we tell the server how to parse the content using a content-type header that describes the object’s format. For URL-encoded types, API Connector automatically sets the content type to application/x-www-form-urlencoded, so you don’t have to set it yourself. If your server expects a different content type, you can manually set content type of application/json to override it, by entering Key = content-type, Value = application/json in the Headers table.

Missing Records

By default, many API servers return only a limited number of rows in each response. To receive additional rows, there is usually some kind of pagination system, where you need to add parameters for page number and starting index. Consult the API documentation for specifics, looking for terms like “page”, “limit”, and “offset”.

Non-JSON Response Types

API Connector currently only supports JSON responses. This means that if your response is in text or XML, the request won’t work. Most APIs provide a JSON option, so look for a JSON endpoint to resolve this error.

Quotas and Limits

The API you’re accessing may limit the number or rate of requests. Google Sheets itself also has built-in limits, as documented here: https://developers.google.com/apps-script/guides/services/quotas. There is a limit of 20,000 API calls quota per day per user, per sheet.

To avoid inadvertently reaching these limits, limit triggers and queries where possible (e.g. don’t run hourly refreshes if you only need daily). Since these limits are per user, you may also hit the API limit if you’re running your own custom scripts or functions in addition to requests from API Connector.

Request Form Syntax Errors

When you’re reading API documentation, you’ll likely see examples based on different coding languages. Don’t copy these in directly — API Connector is a no-code method of interaction with APIs, so pasting in code snippets won’t work.

Wrong: https://api.football-v1.com/v2/players/player/{player_id}
Right: https://api.football-v1.com/v2/players/player/29

Just type in the URL, any headers, and other options. Check the quick start for an example of what a completed API request looks like.

Restricted User Agent

Google Apps script doesn’t enable custom user agents. This means any request from API Connector will use Google’s default user agent ‘Mozilla/5.0 (compatible; Google-Apps-Script)’. Unfortunately certain APIs may block requests from Google’s User Agent. If that is the case, you will need to ask the platform to lift this restriction on their API.

Restricted IP Address

All requests from API Connector will be sent through Google’s servers, and will therefore appear to come from an IP address associated with Google Inc. This may prevent a request from resolving if the API server has blocked requests from Google’s IP addresses. This also means you can’t directly query your own device’s location through a geolocation API.

Scheduling Issues

If you are experiencing issues with your scheduled reports, please consult this list of troubleshooting tips specific to triggers: Troubleshooting Triggers

Un-even/Mismatched Output Rows

As JSON API responses aren’t specifically designed for spreadsheets, the API Connector add-on uses logic to convert JSON responses into a tabular format for Google Sheets. In certain cases, this results in mismatched output rows. If you experience this issue, try changing to a different report style.

Other

Still having trouble? Check the knowledge base or send a message through the API Connector Contact Form. You’ll receive a response shortly!

Comments:0

Leave a Reply

Your email address will not be published.