{"id":13781593,"url":"https://github.com/csquared/arduino-restclient","last_synced_at":"2025-12-17T18:50:55.082Z","repository":{"id":7185335,"uuid":"8488220","full_name":"csquared/arduino-restclient","owner":"csquared","description":"Arduino RESTful HTTP Request Library","archived":false,"fork":false,"pushed_at":"2018-12-04T22:53:50.000Z","size":62,"stargazers_count":207,"open_issues_count":14,"forks_count":134,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-11T15:38:01.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csquared.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-28T21:12:53.000Z","updated_at":"2024-11-18T13:09:12.000Z","dependencies_parsed_at":"2022-08-20T01:21:04.483Z","dependency_job_id":null,"html_url":"https://github.com/csquared/arduino-restclient","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/csquared/arduino-restclient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csquared%2Farduino-restclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csquared%2Farduino-restclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csquared%2Farduino-restclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csquared%2Farduino-restclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csquared","download_url":"https://codeload.github.com/csquared/arduino-restclient/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csquared%2Farduino-restclient/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27785523,"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-12-17T02:00:08.291Z","response_time":55,"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":[],"created_at":"2024-08-03T18:01:27.427Z","updated_at":"2025-12-17T18:50:55.064Z","avatar_url":"https://github.com/csquared.png","language":"C++","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# RestClient for Arduino\n\nHTTP Request library for Arduino and the Ethernet shield.\n\n# Install\n\nClone (or download and unzip) the repository to `~/Documents/Arduino/libraries`\nwhere `~/Documents/Arduino` is your sketchbook directory.\n\n    \u003e cd ~/Documents/Arduino\n    \u003e mkdir libraries\n    \u003e cd libraries\n    \u003e git clone https://github.com/csquared/arduino-restclient.git RestClient\n\n# Usage\n\n### Include\n\nYou need to have the `Ethernet` library already included.\n\n```c++\n#include \u003cEthernet.h\u003e\n#include \u003cSPI.h\u003e\n#include \"RestClient.h\"\n```\n\n### RestClient(host/ip, [port])\n\nConstructor to create an RestClient object to make requests against.\n\nUse domain name and default to port 80:\n```c++\nRestClient client = RestClient(\"arduino-http-lib-test.herokuapp.com\");\n```\n\nUse a local IP and an explicit port:\n```c++\nRestClient client = RestClient(\"192.168.1.50\",5000);\n```\n\n### dhcp()\n\nSets up `EthernetClient` with a mac address of `DEADBEEFFEED`. Returns `true` or `false` to indicate if setting up DHCP\nwas successful or not\n\n```c++\n  client.dhcp()\n```\n\nNote: you can have multiple RestClient objects but only need to call\nthis once.\n\nNote: if you have multiple Arduinos on the same network, you'll need\nto give each one a different mac address.\n\n### begin(byte mac[])\n\nIt just wraps the `EthernetClient` call to `begin` and DHCPs.\nUse this if you need to explicitly set the mac address.\n\n```c++\n  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };\n  if (client.begin(mac) == 0) {\n     Serial.println(\"Failed to configure Ethernet using DHCP\");\n  }\n```\n\n### Manual Ethernet Setup\n\nYou can skip the above methods and just configure the EthernetClient yourself:\n\n```c++\n  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };\n  //the IP address for the shield:\n  byte ip[] = { 192, 168, 2, 11 };\n  Ethernet.begin(mac,ip);\n```\n\n```c++\n  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };\n  Ethernet.begin(mac);\n```\n\nThis is especially useful for debugging network connection issues.\n\n## RESTful methods\n\nAll methods return an HTTP status code or 0 if there was an error.\n\n### `get(const char* path)`\n### `get(const char* path, String* response)`\n\nStart making requests!\n\n```c++\nint statusCode = client.get(\"/\"));\n```\n\nPass in a string *by reference* for the response:\n```\nString response = \"\";\nint statusCode = client.get(\"/\", \u0026response);\n```\n\n### post(const char* path, const char* body)\n### post(const char* path, String* response)\n### post(const char* path, const char* body, String* response)\n\n```\nString response = \"\";\nint statusCode = client.post(\"/\", \u0026response);\nstatusCode = client.post(\"/\", \"foo=bar\");\nresponse = \"\";\nstatusCode = client.post(\"/\", \"foo=bar\", \u0026response);\n```\n\n### put(const char* path, const char* body)\n### put(const char* path, String* response)\n### put(const char* path, const char* body, String* response)\n\n```\nString response = \"\";\nint statusCode = client.put(\"/\", \u0026response);\nstatusCode = client.put(\"/\", \"foo=bar\");\nresponse = \"\";\nstatusCode = client.put(\"/\", \"foo=bar\", \u0026response);\n```\n\n### del(const char* path)\n### del(const char* path, const char* body)\n### del(const char* path, String* response)\n### del(const char* path, const char* body, String* response)\n\n```\nString response = \"\";\nint statusCode = client.del(\"/\", \u0026response);\n```\n\n## Full Example\n\nI test every way of calling the library (against a public heroku app)[https://github.com/csquared/arduino-http-test].\n\nYou can find the file in File-\u003eExamples-\u003eRestClient-\u003efull_test_suite\n\n## Debug Mode\n\nIf you're having trouble, you can always open `RestClient.cpp` and throw at the top:\n\n```c++\n#define HTTP_DEBUG\n```\n\nEverything happening in the client will get printed to the Serial port.\n\n# Thanks\n\n[ricardochimal](https://github.com/ricardochimal) For all his c++ help.  Couldn't have done this without you!\n\n[theycallmeswift](https://github.com/theycallmeswift) Helping incept and debug v1.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsquared%2Farduino-restclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsquared%2Farduino-restclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsquared%2Farduino-restclient/lists"}