6 cURL Interface

_images/curl_logo.png

SquidNet supports the cURL command line tool. cURL is a command line tool for getting or sending files using URL syntax. To use cURL with SquidNet, just enclose your JSON request inside a text file (*.json).

Hint

The sample JSON code fragment below (and others) can he downloaded from here.

The cURL command line utility can be downloaded from the main website.

6.1 cURL Example #1

Here’s a simple cURL example on getting details about a specific studio account.

Contents of studio_account_get.json:

{
    "Request": "STUDIO_ACCOUNT_GET",
    "Properties":
    {
        "StudioName": "ABC Studios"
    }
}

Execute cURL command as follows:

curl -k -v -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data-binary @studio_account_get.json "https://squidnet.dyndns.org:17389/?username=Administrator&password=********&requestType=JsonAdminRequest"

Tip

Note that this cURL command uses the secure HTTPS SSL protocol.

Command output (studio account information at the bottom):

*   Trying 23.112.155.135...
* Connected to squidnet.dyndns.org (23.112.155.135) port 17389 (#0)
* TLSv1.2, TLS handshake, Client hello (1):
* TLSv1.2, TLS handshake, Server hello (2):
* TLSv1.2, TLS handshake, CERT (11):
* TLSv1.2, TLS handshake, Server finished (14):
* TLSv1.2, TLS handshake, Client key exchange (16):
* TLSv1.2, TLS change cipher, Client hello (1):
* TLSv1.2, TLS handshake, Finished (20):
* TLSv1.2, TLS change cipher, Client hello (1):
* TLSv1.2, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES256-GCM-SHA384
* Server certificate:
*        subject: C=TR; ST=BORNOVA; L=IZMIR; OU=INFORMATION TECHNOLOGIES; O=YASAR UNIVERSITESI; CN=*.yasar.edu.tr
*        start date: 2015-02-09 13:48:33 GMT
*        expire date: 2017-02-08 13:48:33 GMT
*        issuer: C=TR; O=TÜRKTRUST Bilgi \U0130leti\U015Fim ve Bili\U015Fim Güvenli\U011Fi Hizmetleri A.\U015E.; CN=TÜRKTRUST SSL Sertifikas\U0131 Hizmetleri
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> POST /?username=Administrator&password==********&requestType=JsonAdminRequest HTTP/1.1
> User-Agent: curl/7.41.0
> Host: squidnet.dyndns.org:17389
> Accept: application/json
> Content-Type: application/json
> Content-Length: 116
>
* upload completely sent off: 116 out of 116 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Cache: no-cache
Cache: no-cache
< Content-Length: 1168
Content-Length: 1168
< Content-Type: application/x-javascript
Content-Type: application/x-javascript
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *

<
{
        "Request" : "STUDIO_ACCOUNT_GET",
        "Result" : "SUCCESS",
        "ResultDesc" : "SUCCESS",
        "Data" : {
                "CID" : "CID:SQN-18092017-0FF77",
                "StudioName" : "ABC Studios",
                "RenderPathPrefix" : "2ECF0C",
                "Website" : "joe@abcstudios.com",
                "ContactEmail" : "user@abcstudios.com",
                "Status" : 2,
                "MaxQueueJobs" : 100,
                "SyncStorageGBs" : 100,
                "RegistrationTime" : 1488938999,
                "AppProfiles" : "C4D,LW11,MAXWELL",
                "MaxEnabledUsers" : 0,
                "NumLoggedInUsers" : 0,
                "NumUsers" : 0,
                "ConnectionPassword" : "#A0266756#",
                "Flags" : 0,
                "NumQueuedJobs" : 0,
                "ActiveLeaseCount" : 0,
                "ProjectCacheDays" : 9,
                "DownloadBytes" : "0",
                "UploadBytes" : "0",
                "NumJobsSubmitted" : 0,
                "NumJobsCompleted" : 0,
                "LeasePurchaseOption" : 2,
                "ActiveRenderCredits" : 0,
                "LifetimeCoreHrs" : 0,
                "LifetimeRenderCredits" : 0,
                "LifetimeRenderCost" : 0,
                "XferLimitBpsUpload" : 0,
                "XferLimitBpsDownload" : 0,
                "CurrentRenderCredits" : 0,
                "ArchiveDays" : 21,
                "MaxTransferChannels" : 5,
                "MaxTransferStreams" : 5,
                "FtpRetentionDays" : 3,
                "JobsSubmittedToday" : 0,
                "LastLoginTime" : 0,
                "JobQueueDays" : 4,
                "UploadRate" : 0,
                "DownloadRate" : 0
        }
}* Connection #0 to host squidnet.dyndns.org left intact

6.2 cURL Example #2

Here’s a simple cURL example on getting details about a specific studio account using SQL syntax.

Contents of sql_select_studio.json:

{
    "Request": "SQL_SELECT",
    "Properties":
    {
        "statement": "select cid,studioname,contactemail from studio_table where studioname='Abc Studios';",
        "tableName": "studio_table"
    }
}

Execute cURL command as follows:

curl -k -v -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data-binary @sql_select_studio.json "https://squidnet.dyndns.org:17389/?username=Administrator&password=********&requestType=JsonAdminRequest"

Command output (studio account information at the bottom):

*   Trying 23.112.155.135...
* Connected to squidnet.dyndns.org (23.112.155.135) port 17389 (#0)
* TLSv1.2, TLS handshake, Client hello (1):
* TLSv1.2, TLS handshake, Server hello (2):
* TLSv1.2, TLS handshake, CERT (11):
* TLSv1.2, TLS handshake, Server finished (14):
* TLSv1.2, TLS handshake, Client key exchange (16):
* TLSv1.2, TLS change cipher, Client hello (1):
* TLSv1.2, TLS handshake, Finished (20):
* TLSv1.2, TLS change cipher, Client hello (1):
* TLSv1.2, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES256-GCM-SHA384
* Server certificate:
*        subject: C=TR; ST=BORNOVA; L=IZMIR; OU=INFORMATION TECHNOLOGIES; O=YASAR UNIVERSITESI; CN=*.yasar.edu.tr
*        start date: 2015-02-09 13:48:33 GMT
*        expire date: 2017-02-08 13:48:33 GMT
*        issuer: C=TR; O=TÜRKTRUST Bilgi \U0130leti\U015Fim ve Bili\U015Fim Güvenli\U011Fi Hizmetleri A.\U015E.; CN=TÜRKTRUST SSL Sertifikas\U0131 Hizmetleri
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> POST /?username=Administrator&password==********&requestType=JsonAdminRequest HTTP/1.1
> User-Agent: curl/7.41.0
> Host: squidnet.dyndns.org:17389
> Accept: application/json
> Content-Type: application/json
> Content-Length: 218
>
* upload completely sent off: 218 out of 218 bytes
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Cache: no-cache
Cache: no-cache
< Content-Length: 215
Content-Length: 215
< Content-Type: application/x-javascript
Content-Type: application/x-javascript
< Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: *

<
{
        "Request" : "SQL_SELECT",
        "Result" : "SUCCESS",
        "ResultDesc" : "SUCCESS",
        "Data" : [
                {
                        "CID" : "CID:SQN-18092017-0FF77",
                        "StudioName" : "ABC Studios",
                        "ContactEmail" : "user@abcstudios.com"
                }
        ]
}* Connection #0 to host squidnet.dyndns.org left intact