Skip to content
On this page

Competitors

Competitors are additional URLs that will be tracked along with the main URL. They are used to track competitor sites with the same set of keywords as the parent URL.

Competitor data

FieldDescription
idCompetitor ID
urlURL of the competitor
search_keyword_url_idURL ID this competitor belong to
custom_nameCompetitor custom name
match_subdomainsWhether this competitor matches subdomains
match_nested_urlsWhether this competitor matches nested URL paths
places_image_titleTitle for tracking in image carousel
places_infoPlace extended matching data
places_info.place_cidMatch place by CID
places_info.place_titleMatch place by title
places_info.place_descriptionPlaces description, informational, no matching is performed on description
places_matchPlace's CID (cid_<CID> format) or, if CID is empty, place's title

List competitors

shell
curl 'https://api.nightwatch.io/api/v1/urls/URL_ID/competitors?access_token=ACCESS_TOKEN' \\
  -H 'Content-Type: application/json'

The above command returns JSON structured like this:

json
  [
    { 
      "id":1,
      "url": "http://example.com",
      "match_nested_urls": true,
      "match_subdomains": true,
      "places_image_title": null,
      "places_info": null,
      "places_match": null,
      "search_keyword_url_id": 10,
      "custom_name": "Example Competitor"
    },
    ...
  ]

HTTP Request

GET https://api.nightwatch.io/api/v1/urls/URL_ID/competitors?access_token=ACCESS_TOKEN

URL Parameters

ParameterDescription
url_idThe id of the URL to fetch competitors for

Add competitors

shell
curl 'https://api.nightwatch.io/api/v1/urls/URL_ID/competitors?access_token=ACCESS_TOKEN' \\
  -H 'Content-Type: application/json' \\
  -X POST \\
  -d '{
        "competitor": {
          "id": 2,
          "url": "http://new.example.com/",
          "match_subdomains": true,
          "match_nested_urls": false,
          "places_match": false,
          "places_image_title": null,
          "custom_name": "New Example Competitor"
        }
      }'

The above command returns JSON structured like this:

json
  {
    "id": 2,
    "url": "http://new.example.com/",
    "match_nested_urls": true,
    "match_subdomains": true,
    "places_image_title": null,
    "places_info": null,
    "places_match": null,
    "search_keyword_url_id": 10,
    "custom_name": "New Example Competitor"
  }

HTTP Request

POST https://api.nightwatch.io/api/v1/urls/URL_ID/competitors?access_token=ACCESS_TOKEN

Parameters

ParameterDescription
url*URL to track
match_subdomainsWhether to match subdomains
match_nested_urlsWhether to match subpaths in the URL
places_matchPlace name or CID
places_image_titleTitle for tracking in image carousel
custom_nameCustom competitor name

Parameters marked with * are mandatory.

Remove competitor

shell
curl 'https://api.nightwatch.io/api/v1/urls/URL_ID/competitors/COMPETITOR_ID?access_token=ACCESS_TOKEN' \\
  -X DELETE \\
  -H 'Content-Type: application/json' \\

The above command returns a HTTP 204 response.

HTTP Request

POST https://api.nightwatch.io/api/v1/urls/URL_ID/competitors/COMPETITOR_ID?access_token=ACCESS_TOKEN

Parameters

ParameterDescription
url_id*URL ID the competitor belongs to
competitor_id*Competitor ID to be deleted

Parameters marked with * are mandatory.