code: def _parse_content(response):
      
      if response.status_code != 200:
          raise ApiError(f'unknown error: {response.content.decode()}')
      result = json.loads(response.content)
      if not result['ok']:
          raise ApiError(f'{result["error"]}: {result.get("detail")}')
      return result
docs: parse the response body as JSON, raise on errors