Synthetic API Errors everywhere

Hi,

I find the API’s can be a bit buggy. Synthetic API isn’t returning conditions for a policy when there are conditions:

https://api.newrelic.com/v2/alerts_synthetics_conditions.json

“policy_id” => 15064

In addition to this POSTING to https://api.newrelic.com/v2/alerts_synthetics_conditions/policies/$POLICY_ID.json returns a HTML page.

     <div class="nr-css-App-body">
        <div class="nr-css-AppSection">
            <div class="nr-css-AppSection-content">
                <div id='error-service-app'>
                    <div id="error-message">
                        <h1>Oops! You&apos;ve reached our error page.</h1>
                        <p>This is entirely unintentional on our part. Rest assured that, since we use New Relic ourselves, we&apos;re
                            getting an error report about this problem right now.</p>
                        <p>Here are a few things you could try:</p>


                        <ol>
                            <li>
                                <h3>Refresh your page</h3>
                                <p>Some errors are temporary hiccups</p>
                            </li>
                            <li>
                                <h3>Use the back button</h3>
                                <p>At least you can <a href="javascript:back();">go back</a> to where you were</p>
                            </li>
                            <li>
                                <h3>Get help</h3>
                                <p>Check <a href="https://status.newrelic.com">our status page</a> to monitor potential outages</p>
                                <p>Our <a href="https://docs.newrelic.com">Documentation site</a> has helpful articles</p>
                                <p><a href="https://support.newrelic.com">Get support</a> on the forum or open a ticket to help us debug this error
                                </p>
                            </li>
                        </ol>

                        <div id='error-details'>
                            <h3>When seeking support, please reference the following error message:</h3>
                            <p>Account is not valid in this region</p>
                        </div>
                    </div>
                    <div id='error-code'>403</div>
                </div>
            </div>
        </div>
    </div>

Posting the following data:

"synthetics_condition" => [
                    "name"=> "Uptime",
                    "monitor_id" => $monitorId,
                    "enabled" => false,
                    "terms" => [
                        [
                              "operator" => "above",
                              "priority" => "warning",
                              "threshold" => "1",
                              "time_function" => "all",
                        ],
                        [
                          "operator" => "above",
                          "priority" => "critical",
                          "threshold" => "2",
                          "time_function" => "all",
                        ]
                    ]
 ]

Then even using the explorer results in HTTP errors which is useless.

Hi @inqsupport

Keep in mind that the API Explorer is an old tool that will be gradually phased out in favor of Nerdgraph. At this point, we are only working on game-breaking bugs on this page.

THAT SAID, most of this strange behavior is attributable to two key details:

  1. If you’re searching for multi-location Synthetics conditions, you need to use the multi-location Synthetics condition endpoint (see below for where to find this in the API Explorer). If you’re trying to create a multi-location Synthetics condition, you also need to use the correct endpoint – using the wrong endpoint will either cause an error or result in no data returned.
  2. Currently the API Explorer has been adjusted so that it automatically changes this: authenticating with a REST or Admin API key requires the header X-Api-Key, whereas a Personal API key requires Api-Key. I just checked this on my own account, and when I switch to using a key that starts with NRAK (that’s a user key), X-Api-Key changes to Api-Key.

If you’re using the API Explorer, here is where you’ll need to look to find the endpoint. Note that you will need to select an API key before this will show up in the UI.

Once you find that, make sure that if you select an API key that starts with NRAK you remove the X- that might show up in front of Api-Key.

These two suggestions should get you sorted – let us know if you’re still encountering any issues!