{"id":24525,"library":"restinstance","title":"RESTinstance","description":"RESTinstance is a Robot Framework library for testing RESTful JSON APIs. It provides keywords for GET, POST, PUT, PATCH, DELETE and supports JSON schema validation. Currently at version 1.8.0, released periodically with compatible changes.","status":"active","version":"1.8.0","language":"python","source_language":"en","source_url":"https://github.com/asyrjasalo/RESTinstance","tags":["robot-framework","api-testing","rest","json"],"install":[{"cmd":"pip install robotframework-restinstance","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"RESTinstance is a Robot Framework library, requires robotframework to run.","package":"robotframework","optional":false}],"imports":[{"note":"The library name in Python is 'RESTinstance' (capital R, E, S, T). Import like any Python module.","symbol":"RESTinstance","correct":"from RESTinstance import RESTinstance"}],"quickstart":{"code":"from RESTinstance import RESTinstance\nimport json\n\n# Initialize the library\napi = RESTinstance()\n\n# Example: GET request\nresponse = api.get('https://jsonplaceholder.typicode.com/posts/1', None)\nprint(response.status_code)\nprint(json.dumps(response.json(), indent=2))\n\n# Example: POST request\nbody = '{\"title\": \"foo\", \"body\": \"bar\", \"userId\": 1}'\nresponse = api.post('https://jsonplaceholder.typicode.com/posts', body, None)\nprint(response.status_code)","lang":"python","description":"Minimal example: initialize RESTinstance and perform GET/POST requests. Note: RESTinstance methods return requests.Response objects."},"warnings":[{"fix":"Use requests library directly for standalone Python API testing, or use within Robot Framework tests.","message":"RESTinstance is designed for Robot Framework, not for standalone Python tests. Using it outside Robot Framework may lead to unexpected behavior (e.g., missing 'output_dir' or logging).","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure schema files exist and are valid JSON Schema. If you don't need schema validation, omit the 'schema' parameter.","message":"The library automatically validates responses if a schema is provided. If you set 'schema' in the keyword arguments, but the schema file path is wrong or the schema is invalid, the library raises an exception. This can be confusing if you expect no validation.","severity":"gotcha","affected_versions":"1.0+"},{"fix":"Always pass body as a JSON string (e.g., json.dumps(dict)) or use the `json` parameter if available (check docs).","message":"In version 1.8.0, use of `post`, `put`, `patch`, `delete` keywords with `body` as a string (JSON string) is required. Passing a Python dict may cause serialization issues in future versions.","severity":"deprecated","affected_versions":"1.8.0"},{"fix":"Pass `verify=False` in the keyword arguments (e.g., `api.get(url, None, verify=False)`).","message":"The library verifies SSL certificates by default. If you are testing against a local development server with self-signed certificates, the request will fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with: pip install robotframework-restinstance, then import: from RESTinstance import RESTinstance","cause":"Library installed as 'robotframework-restinstance' but imported as 'RESTinstance' incorrectly.","error":"ImportError: No module named RESTinstance"},{"fix":"Do not pass `output_dir` when initializing RESTinstance in Python directly. Use the default constructor: `RESTinstance()`","cause":"RESTinstance does not accept `output_dir` in `__init__` when used outside Robot Framework; that is a Robot Framework construct.","error":"TypeError: __init__() got an unexpected keyword argument 'output_dir'"},{"fix":"RESTinstance methods return requests.Response objects. Use `response.json()` or `response.status_code`.","cause":"Trying to access a response key directly on the RESTinstance object instead of the returned response object.","error":"KeyError: 'response'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}