This guide explains some of the issues that might arise when you use the Monitoring API v3.
If you are having trouble with an API call, use the APIs Explorer to debug your problem. Here are some issues to watch for when using the API Explorer forms. These mistakes might cause errors or might be accepted but be treated like spelling errors in the API method:
- Do not use quotation marks around field values of any type.
- Be sure to quote strings appearing inside filters. Use double quotation marks (") and not apostrophes (').
- Do not use backslashes or URL-encoding in form fields. If needed, URL-encoding is performed on the field values when you execute the method.
- Look at the Request value shown after executing the call. You might notice the problem there.
- You might want to supply a value for the
pageSizefield, such as
2. This limits the amount of data that is returned as you debug your API call.
If clicking Authorize and Execute in the APIs Explorer does not have any effect, then click the ON-OFF authorization switch at the topt of the APIs Explorer. Then click Execute for your method.
When you are re-trying your method after making changes to the form, you might have to click Execute twice.
General API errors
Here are some of the errors you may see from your API calls:
404. The requested URL was not found on this server. Some part of the URL is incorrect. Compare the URL against the expected values for the API methods. Check for spelling errors ("project" instead of "projects") and capitalization problems ("TimeSeries" instead of "timeSeries").
User is not authorized to access the project (or metric). This might be an authorization problem, but it can also mean that you simply misspelled a project ID or metric type name. Check your spelling and capitalization.
If you are not using the APIs Explorer, then try using it. If your API call works in the Explorer, then you probably do have an authorization issue in the environment you're using for your API call. Check in the API manager page to verify that the Monitoring API v3 is enabled for your project.
Field filter had an invalid value: Check the spelling and formatting of your monitoring filter. For more information, see Monitoring Filters.
Request was missing field interval.endTime: You also see this message if the end time is present but is not properly formatted. If you are using the APIs Explorer, do not quote the value of the time field. Here are some examples of correct time specifications:
2016-05-11T01:23:45Z 2016-05-11T01:23:45.678Z 2016-05-11T01:23:45.678+05:00 2016-05-11T01:23:45.678-04:30
If your API call returns status code 200 and an empty response, there are several possibilities:
If your call uses a filter, then the filter might not have matched anything. The filter match is case-sensitive. To resolve filter problems, start by specifying only one filter component, such as
metric.type, and see if you get results. Add the other filter components one-by-one.
If you are working with a custom metric, you might not have specified the project where your custom metric is defined.
If you are fetching time series data and some of the data points seem to be missing, then check the following additional causes:
If the data is more than a few weeks old, it might have expired. See the Quota Policy for more information on data retention.
If the data was just written, it might not yet be in Monitoring. For more information, see Latency of metric data.
Check that you specified the time interval correctly:
- Check that the end time is correct.
- Check that the start time is correct. If the start time is missing or malformed, it will default to the end time and the time interval will match only points whose start and end times are exactly the interval's end time. For more information, see Time Intervals.