{"id":27515727,"url":"https://github.com/waqi-dev-community/waqi-js-client","last_synced_at":"2025-10-10T02:13:38.131Z","repository":{"id":190259876,"uuid":"682248182","full_name":"waqi-dev-community/waqi-js-client","owner":"waqi-dev-community","description":"JavaScript client library for the World Air Quality Index (WAQI) APIs","archived":false,"fork":false,"pushed_at":"2023-10-03T21:06:57.000Z","size":98,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-01T13:52:11.316Z","etag":null,"topics":["airquality","android","devs","ios","open-source","waqi","web"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waqi-dev-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-23T19:00:50.000Z","updated_at":"2025-02-26T11:52:10.000Z","dependencies_parsed_at":"2023-09-24T21:06:23.345Z","dependency_job_id":"b83ab5cd-253a-4812-afff-1670a1a3f941","html_url":"https://github.com/waqi-dev-community/waqi-js-client","commit_stats":{"total_commits":105,"total_committers":2,"mean_commits":52.5,"dds":0.01904761904761909,"last_synced_commit":"37ac366372d59a2cb1c965f1725a253d8c969d3e"},"previous_names":["waqi-dev-community/waqi-js-client"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/waqi-dev-community/waqi-js-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waqi-dev-community%2Fwaqi-js-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waqi-dev-community%2Fwaqi-js-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waqi-dev-community%2Fwaqi-js-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waqi-dev-community%2Fwaqi-js-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waqi-dev-community","download_url":"https://codeload.github.com/waqi-dev-community/waqi-js-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waqi-dev-community%2Fwaqi-js-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002536,"owners_count":26083399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["airquality","android","devs","ios","open-source","waqi","web"],"created_at":"2025-04-18T01:18:29.687Z","updated_at":"2025-10-10T02:13:38.104Z","avatar_url":"https://github.com/waqi-dev-community.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WAQI JavaScript Client\n\nJavaScript client library for the World Air Quality Index (WAQI) APIs. See documentation [here](https://aqicn.org/json-api/doc/).\nAll available API modules are supported - City feed, Geolocalized feed, Search, and Map Queries.\n\n### Installation\n\nYou can include this package in your JavaScript project using npm or yarn:\n\n```shell\nnpm install waqi-js-client\n```\n\n### Get API key\n\nSign up for an API key [here](https://aqicn.org/data-platform/token/)\n\n### Making Requests\n\nThe primary `API` class is a factory class that creates objects for each of the API modules, allowing you to make requests to any of them with your desired request parameters. You have to first create an object for it, then access your desired API module via the object. See the code snippets below:\n\n```javascript\nconst apiKey = \"YOUR_API_KEY\";\nconst waqiAPI = new API(apiKey);\n```\n\nReplace `'YOUR_API_KEY'` with the actual API key you already obtained from above.\n\n**For City Feed:**\n\n```javascript\nconst cityFeedEntity = waqiAPI.cityFeed();\ncityFeedEntity.setCity(\"Munich\");\ncityFeedEntity\n  .fetchItems()\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((error) =\u003e {\n    console.error(error);\n  });\n```\n\n**For Search:**\n\n```javascript\nconst searchEntity = waqiAPI.search();\nsearchEntity.setKeyword(\"Johannesburg\");\nsearchEntity\n  .fetchItems()\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((error) =\u003e {\n    console.error(error);\n  });\n```\n\n**For Lat/Lng based Geolocalized feed:**\n\n```javascript\nconst geoFeedEntity = waqiAPI.geoFeed();\ngeoFeedEntity.setCoordinates(37.7749, -122.4194);\ngeoFeedEntity\n  .fetchItems()\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((error) =\u003e {\n    console.error(error);\n  });\n```\n\n**For IP based Geolocalized feed:**\n\n```javascript\nconst ipFeedEntity = waqiAPI.ipFeed();\nipFeedEntity.setIP(\"MY_IP\");\nipFeedEntity\n  .fetchItems()\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((error) =\u003e {\n    console.error(error);\n  });\n```\n\n**For Map Queries:**\n\n```javascript\nconst mapStationEntity = waqiAPI.mapStation();\nmapStationEntity.setMapBounds(40.712, -74.006, 34.052, -118.243);\nmapStationEntity\n  .fetchItems()\n  .then((response) =\u003e {\n    console.log(response);\n  })\n  .catch((error) =\u003e {\n    console.error(error);\n  });\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaqi-dev-community%2Fwaqi-js-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaqi-dev-community%2Fwaqi-js-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaqi-dev-community%2Fwaqi-js-client/lists"}