Exec

Exaplanation of the Exec API for the wsCurl command.

The exec API enables you to specify a response to the query you are making. The response can be either JSON or HTML and the syntax is as follows:

var response = wsCurl.exec();

You can use the following syntax to check for the response:

println(wsCurl.error);

The exec API contains a number of response codes that may be returned. As definied by the cURL project, the currently available response codes are as follows:

Option Integer Value Definition
CURLE_OK 0 No errors occurred - the operation completed normally.
CURLE_UNSUPPORTED_PROTOCOL 1

The target URL is using a protocol used is not supported. Please check if the problem might be one of the following:

  • Compile-time option that was not used.
  • Misspelled protocol string.
  • Protocol that libcurl does not have any code for.
CURLE_FAILED_INIT 2 An early initialization failed and the operation did not complete.
CURLE_URL_MALFORMAT 3 The target URL was not properly formatted.
CURLE_NOT_BUILT_IN 4 A required feature, proptocol, or option was found to be missing from your version of libcurl. You will need to get a rebuilt libcurl in order for this to function.
CURLE_COULDNT_RESOLVE_PROXY 5 Could not resolve the given proxy host.
CURLE_COULDNT_RESOLVE_HOST 6 Could not resolve the given remote host.
CURLE_COULDNT_CONNECT 7 Could not connect to either the host or the proxy.
CURLE_FTP_WEIRD_SERVER_RESPONSE 8 Unexpected or improper response received from FTP server. This may mean that the given server is not a valid FTP server.
CURLE_REMOTE_ACCESS_DENIED 9 The request for a remote connection to the given resource was denied.
CURLE_FTP_ACCEPT_FAILED 10 FTP handshake did not succeed and the operation did not complete.
CURLE_FTP_WEIRD_PASS_REPLY 11 Unexpected or improper response received after sending FTP password to server.
CURLE_FTP_ACCEPT_TIMEOUT 12 Timeout occurred during an active FTP session.
CURLE_WEIRD_PASV_REPLY 13 Unexpected or improper response received in response to either a PASV or a EPSV command.
CURLE_FTP_WEIRD_227_HOST 14 FTP servers typically return a 227-line in response to a PASV command. This code is returned if the libcurl fails to parse that response.
CURLE_FTP_CANT_GET_HOST 15 Internal failure occurred while looking up the given host for a new connection.
CURLE_FTP_COULDNT_SET_TYPE 17 Error occurred while tyring to set the transfer mode to either ASCII or binary.
CURLE_PARTIAL_FILE 18 The file transfer was either shorter or longer than expected. This typically occurs when the server first reports a transfer size and then the actual size fails to match the reported size.
CURLE_FTP_COULDNT_RETR_FILE 19 Unexpected or improper response received in response to a RETR command. This error can also occur when a a zero byte transfer completes.
CURLE_QUOTE_ERROR 21 This error typically occurs when a 400 or higher error code is returned from the FTP server while a custom QUOTE command is being sent.
CURLE_HTTP_RETURNED_ERROR 22 This error is returned if the CURLOPT_FAILONERROR option is set to TRUE and the HTTP server returns an error code that is 400 or higher.
CURLE_WRITE_ERROR 23 This code is returned either when an error occurs while writing data to a local file or when an error is returned from a write callback.
CURLE_UPLOAD_FAILED 25 There was a failure starting the upload. For FTP, this typically occurs when the server denies the STOR comand. Please see the error buffer fto find why the STOR command was denied.
CURLE_READ_ERROR 26 This code is returned either when an error occurs while reading a local file or when an error is returned from a read callback.
CURLE_OUT_OF_MEMORY 27

This code will be returned when a memory allocation request fails.

Warning: This code indicates a very serious problem is occurring. However, this code can sometimes indicate a conversion error intead of a memory allocation error if the CURL_DOES_CONVERSIONS option is defined.
CURLE_OPERATION_TIMEOUT 28 The specified timeout was reached and the operation was terminated.
CURLE_FTP_PORT_FAILED 30 The FTP PORT command returned an error. This typically occurs if you specified an improper or incomplete address.
CURLE_FTP_COULDNT_USE_REST 31

An error was returned from the FTP REST command.

Note: There is a problem with the server - it should never occur if the server is OK.
CURLE_RANGE_ERROR 33 The RANGE command did not work. This typically occurs if the server does not support range requests.
CURLE_HTTP_POST_ERROR 34 This error usually occurs due to some kind of internal confusion. Check your settings and your given connection parameters.
CURLE_SSL_CONNECT_ERROR 35 A problem has occurred in the SSL/TLS handshake. Some possible cause are certificate format, path, or permission errors. Password errors may also be the reason, as well as other unrelated errors. Consult the error buffer for a more specific explanation of the error.
CURLE_BAD_DOWNLOAD_RESUME 36 The download could not be resumed because the specified offset was out of the file boundary.
CURLE_FILE_COULDNT_READ_FILE 37 THis means that a given file could not be opened. This error typically occurs when the given file path does not identify a specific file. Check file permissions as well - they also may cause this error code to be returned.
CURLE_LDAP_CANNOT_BIND 38 LDAP cannot bind - the bind operation failed.
CURLE_LDAP_SEARCH_FAILED 39 The LDAP search operation failed.
CURLE_FUNCTION_NOT_FOUND 41 A required zlib function was not found.
CURLE_ABORTED_BY_CALLBACK 42 A callback returned the 'abort' command.
CURLE_BAD_FUNCTION_ARGUMENT 43 This means an internal error has occurred. Usually this is due to a function being called with a bad parameter.
CURLE_INTERFACE_FAILED 45 An interface error has occurred. Typically, this occurs when the outgoing interface has not been correctly set. You can use the CURLOPT_INTERFACE option to specify the correct interface's outgoing IP address.
CURLE_TOO_MANY_REDIRECTS 47 Too many redirects have occurred or the maximum number of redirects haS been reached. You can use the CURLOPT_MAXREDIRS option to set the number of redirects that are allowed.
CURLE_UNKNOWN_OPTION 48 An option that was passed to libcurl is either not known or not recognized. You will need to consult the appropriate documentation but this is typically a problem in whaever application is using libcurl. Consult the error buffer, as it may contain more detailed information about the precise issue.
CURLE_TELNET_OPTION_SYNTAX 49 A telnet option string was illegally or incorrectly formatted.
CURLE_PEER_FAILED_VERIFICATION 51 The server's SSL certificate of SSH md5 fingerprint is not correct.
CURLE_GOT_NOTHING 52 No response was received from the server.
CURLE_SSL_ENGINE_NOTFOUND 53 TCOuld not find the specified SSL crypto engine.
CURLE_SSL_ENGINE_SETFAILED 54 COuld not set the specified SSL crypto engine as the default.
CURLE_SEND_ERROR 55 Could not send network data - the attempt failed.
CURLE_RECV_ERROR 56 COuld not receive network data - the attempt failed.
CURLE_SSL_CERTPROBLEM 58 There is a problem with the local client certificate.
CURLE_SSL_CIPHER 59 Could not use the specified SSL cypher.
CURLE_SSL_CACERT 60 Could not use any known CA certificates to authenticate peer certificate.
CURLE_BAD_CONTENT_ENCODING 61 The specified transfer encoding is not recognized.
CURLE_LDAP_INVALID_URL 62 THe specified LDAP URL is invalid.
CURLE_FILESIZE_EXCEEDED 63 the file exceeds the maximum size limits.
CURLE_USE_SSL_FAILED 64 The requested SSL FTP level failed.
CURLE_SEND_FAIL_REWIND 65 Attempt to rewind data during a send operation failed.
CURLE_SSL_ENGINE_INITFAILED 66 Could not initialize the SSL engine - the attempt failed.
CURLE_LOGIN_DENIED 67 The remote server denied login permission.
CURLE_TFTP_NOTFOUND 68 THe specified file is not found on the TFTP server.
CURLE_TFTP_PERM 69 There is a permission problem on the TFTP server.
CURLE_REMOTE_DISK_FULL 70 THe server has run out of disk space.
CURLE_TFTP_ILLEGAL 71 The attempted TFTP operation is illegal.
CURLE_TFTP_UNKNOWNID 72 The specified TFTP transfer ID is unknown.
CURLE_REMOTE_FILE_EXISTS 73 The specified file already exists and will not be over-written.
CURLE_TFTP_NOSUCHUSER 74 THis error indicates that there is a problem with the server - a TFTP server that is working correctly should never return this error.
CURLE_CONV_FAILED 75 Character conversion failed.
CURLE_CONV_REQD 76 Caller must register coversion callbacks in order for the operation to succeed.
CURLE_SSL_CACERT_BADFILE 77 A problem occurred while reading the SSL CA certificate path. This could be due to access rights or an incorrect path.
CURLE_REMOTE_FILE_NOT_FOUND 78 The resource specified in the URL does not exist.
CURLE_SSH 79  
CURLE_SSL_SHUTDOWN_FAILED 80 The SSL connection failed to shut down.
CURLE_AGAIN 81

This means that the SSL socket is not ready to send or receive. You must wait until it is ready and try again.

Note: This code is only returned from curl_easy_recv and curl_easy_send.
CURLE_SSL_CRL_BADFILE 82 The CRL file could not be loaded.
CURLE_SSL_ISSUER_ERROR 83 The SSL issuer check failed.
CURLE_FTP_PRET_FAILED 84

This error usually occurs either when the FTP server does not understand the PRET command or when it does not support the given argument.

CURLE_RTSP_CSEQ_ERROR 85 The RTSP CSeq numbers do not match.
CURLE_RTSP_SESSION_ERROR 86 The RTSP CSeq session identifiers do not match.
CURLE_FTP_BAD_FILE_LIST 87 Could not parse the FTP file list. This usually occurs during FTP wildcard loading.
CURLE_CHUNK_FAILED 88 An error occurred during the chunk callback.