Skip to content

Instantly share code, notes, and snippets.

@carmageddon888
Last active March 9, 2023 11:46
Show Gist options
  • Save carmageddon888/a5caf276a635c7c764ec7ddab830d041 to your computer and use it in GitHub Desktop.
Save carmageddon888/a5caf276a635c7c764ec7ddab830d041 to your computer and use it in GitHub Desktop.
API Doc for Compare URLs Tool APIs

NOTE:

To check success of API, refer "ok" field of "data" in response.

Value true would mean success

API 1:

==========

Example Request:

GET /api/v2/tools/user-agents

Accept: application/json

Query params: device_type=desktop

Example Response:

200 Success
content-type: application/json
{
  "ok" : true,
  "data" : {
    "desktop_user_agents" : [ {"label: "Desktop Windows 10 / Chrome 57", "id: 18}, {"label: "Seoradar", "id: 19}, ... ]
  }
}

Example Request:

GET /api/v2/tools/user-agents

Accept: application/json

Query params: device_type=mobile

Example Response:

200 Success
content-type: application/json
{
  "ok" : true,
  "data" : {
    "mobile_user_agents" : [ {"label: "Mobile iOS 9.2 (iPhone) / Safari", "id: 31}, {"label: "Mobile iOS 7.1 (iPad) / Safari", "id: 32}, ... ]  }
}

Example Request:

GET /api/v2/tools/user-agents

Accept: application/json

Query params: None

Example Response:

200 Success
content-type: application/json
{
  "ok" : true,
  "data" : {
    "desktop_user_agents" : [ {"label: "Desktop Windows 10 / Chrome 57", "id: 18}, {"label: "Seoradar", "id: 19}, ... ],
    "mobile_user_agents" : [ {"label: "Mobile iOS 9.2 (iPhone) / Safari", "id: 31}, {"label: "Mobile iOS 7.1 (iPad) / Safari", "id: 32}, ... ]
  }
}

API 2:

==========

Example Request:

POST /api/v2/tools/compare-urls

Accept: application/json

params : {
  "first_url"     => "https://storyweaver.org.in/about/our-story",
  "second_url"    => "https://uat.pbees.party/about/our-story",
  "device_type"   => "desktop", // can be "mobile" also
  "user_agent_id" => 31,
  "use_proxy"     => true,
  "crawl_type"    => "fetched" // can be "rendered" also
}

Example Response:

202 Response Accepted
content-type: application/json
{
  "ok" : true,
  "data": {
    "id": 509,
    "message": "processing.."
  }
}
400 Bad Request
content-type: application/json
{
  "ok" : false,
  "data": {
    "id": 509,
    "message": "invalid url"
  }
}
500 Internal Server Error
content-type: application/json
{
  "ok" : false,
  "data": {
    "id": 509,
    "message": "server error"
  }
}

API 3:

==========

Example Request:

GET /api/v2/tools/check-status

Accept: application/json

Query params:

id: 509
diff_format: 2
diff_type: 1
diff_category: "Compare Fetched URLs"

Example Response:

200 Success
content-type: application/json
{
  "ok" : true,
  "data" : {
    "id" : 509,
    "status" : true
  }
}

API 4:

==========

Example Request:

GET /api/v2/tools/content-diff

Accept: application/json

Query params:
id: 509
diff_format: 2
diff_type: 1
diff_category: "Compare Fetched URLs"

Example Response:

200 Success
Content-Type: application/json
{
  "ok": true,
  "data": {
    "id": 509,
    "html": ""
  }
}

500 Internal Server Error
Content-Type: application/json
{
  "ok": false,
  "data": {
    "id": 509,
    "message": "server error"
  }
}

There may be more error codes for this API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment