Sample direct calls with Basic Authentication
Create access token
curl -v -d '{"id":1,"method":"oauth2.createAccessToken","params":{"service_
key":"m9f.....uw3","client":{"client_id":"yq7...qa6x","client_
secret":"A...a"},"token_data":{"grant_type":"implicit"},"uri":{"redirect_
uri":"https://some.com/cb"},"user_context":"testUser1455730448397"},"jsonrpc":"2.0"}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 310
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 310 out of 310 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 231
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"token_type":"bearer","return_type":"json","access_
token":"q3nxsetjry582yhq2ej3xa7j","expires_in":36000,"scope":null,"user_
context":"testUser1455730448397","uri":null,"extended":null,"state":null}
Create authorization code
curl -v -d '{ "id":1,"method":"oauth2.createAuthorizationCode","params":{"service_
key":"m9f.....uw3","client":{"client_id":"yq7...qa6x"},"response_
type":"code","uri":{"redirect_uri":"https://some.com/cb"},"user_context":
"testUser1455730448397"},"jsonrpc":"2.0"}' 'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -
k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 277
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 277 out of 277 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 168
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"code":"33benr9fb9vah3g8ys7scmh5","uri":{"redirect_
uri":"https://some.com/cb?code=33benr9fb9vah3g8ys7scmh5","state":""}},"error":null}
Create access token with authorization code
curl -v -d '{"id":1,"method":"oauth2.createAccessToken","params":{"service_
key":"m9f.....uw3","client":{"client_id":"yq7...qa6x","client_
secret":"A...a"},"token_data":{"grant_type":"authorization_
code","code":"33benr9fb9vah3g8ys7scmh5","scope":"scope1"},"uri":{"redirect_
uri":"https://some.com/cb"},"user_context": "testUser1455730448397"},"jsonrpc":"2.0"}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 372
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 372 out of 372 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 274
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"token_type":"bearer","return_type":"json","access_
token":"s4b7qs24qfns2m3ecjmuvgh4","expires_in":36000,"refresh_
token":"xekntywdyp2hg7yvfbaxac5g","scope":null,"user_
context":"testUser1455730448397","uri":null,"extended":null,"state":null}}
Update access token
curl -v -d '{"id":1,"method":"oauth2.updateAccessToken","params":{"service_
key":"m9f.....uw3","client":{"client_id":"yq7...qa6x","client_
secret":"A...a"}, "access_token":"s4b7qs24qfns2m3ecjmuvgh4","user_context":"testUser1455730448397", "expires_in":600},"jsonrpc":"2.0"}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 287
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 287 out of 287 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 322
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"token_type":"bearer","access_
token":"s4b7qs24qfns2m3ecjmuvgh4","expires":"2018-11-21T10:57:43Z","refresh_token_
expires":1542765336403,"scope":null,"user_context":"testUser1455730448397","uri":null,"grant_
type":"authorization_code","client_id":"yq7...qa6x","extended":null}}
Fetch access token
curl -v -d '{"id": 1,"jsonrpc":"2.0","method": "oauth2.fetchAccessToken","params": {"service_
key":"m9f.....uw3","access_token": "s4b7qs24qfns2m3ecjmuvgh4"}}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 157
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 157 out of 157 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 242
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"token_type":"bearer","expires":"2018-11-
21T10:57:43Z","scope":null,"user_context":"testUser1455730448397","uri":null,"grant_
type":"authorization_code","client_id":"yq7...qa6x","extended":null}}
Fetch application
curl -v -d '{"id": 1,"jsonrpc":"2.0","method":"oauth2.fetchApplication","params":{"service_
key":"m9f.....uw3","client":{"client_id":"yq7...qa6x","client_
secret":"A...a"}}}' 'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 187
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 187 out of 187 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 82
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"id":251547,"name":"TestOAuthRegisterCallBack"}}
Fetch user application
curl -v -d '{ "id":1, "method":"oauth2.fetchUserApplications", "params":{ "service_
key":"m9f.....uw3", "user_context":"testUser1455730448397" },"jsonrpc":"2.0"}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 162
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 162 out of 162 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 195
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":[{"id":251547,"name":"TestOAuthRegisterCallBack","access_tokens":
["s4b7qs24qfns2m3ecjmuvgh4","q3nxsetjry582yhq2ej3xa7j"],"client_
id":"yq7...qa6x"}]}
Revoke access token
curl -v -d '{ "id":1, "method":"oauth2.revokeAccessToken", "params":{ "service_
key":"m9f.....uw3", "client": { "client_id":"yq7...qa6x", "client_
secret":"A...a" }, "access_token":"s4b7qs24qfns2m3ecjmuvgh4" },"jsonrpc":"2.0"}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 240
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 240 out of 240 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 38
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":true}
Revoke user application
curl -v -d '{ "id":1, "method":"oauth2.revokeUserApplication", "params":{ "service_
key":"m9f.....uw3", "client": { "client_id":"yq7...qa6x", "client_
secret":"A...a" }, "user_context":"testUser1455730448397" },"jsonrpc":"2.0"}'
'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 241
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 241 out of 241 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 38
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":true}
Refresh token
curl -k -v -d '{"id":1,"method":"oauth2.createAccessToken","params":{"service_
key":"m9f.....uw3","client":{"client_id":"yq7...qa6x","client_
secret":"A...a"},"token_data":{"grant_type":"refresh_token","refresh_
token":"xekntywdyp2hg7yvfbaxac5g"},"uri":{"redirect_uri":"https://some.com/cb"},"user_
context":null},"jsonrpc":"2.0"}' 'https://X.X.57.97:8083/v2/json-rpc' -u root:changeme -k
* Trying X.X.57.97...
* Connected to X.X.57.97 (X.X.57.97) port 8083 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification SKIPPED
* server certificate status verification SKIPPED
* common name: api.example.com (does not match 'X.X.57.97')
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* start date: Wed, 14 Nov 2018 03:28:23 GMT
* expire date: Fri, 21 Oct 2118 03:28:23 GMT
* issuer: C=defC,ST=defST,L=defL,O=defO,OU=defOU,CN=api.example.com
* compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user 'root'
> POST /v2/json-rpc HTTP/1.1
> Host: X.X.57.97:8083
> Authorization: Basic cm9vdDpjaGFuZ2VtZQ==
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 339
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 339 out of 339 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json;charset=UTF-8
< Cache-Control: no-store
< Content-Length: 274
< Server: Jetty(8.1.3.v20120522)
<
* Connection #0 to host X.X.57.97 left intact
{"jsonrpc":"2.0","id":1,"result":{"token_type":"bearer","return_type":"json","access_
token":"z242k8wyshjmvjrkcckask2f","expires_in":36000,"refresh_token":"epecdr7zzfjxwwfu35395dx9","scope":null,"user_
context":"testUser1455730448397","uri":null,"extended":null,"state":null}}