'''''This page has moved to https://github.com/GENI-NSF/geni-ch/wiki/Testing-with-curl'''''
-----
-----
-----
Developers interested in testing the Uniform Clearinghouse APIs at the GPO Clearinghouse can do so using [http://curl.haxx.se/ curl], a command line tool that acts as an HTTP client. The Clearinghouse APIs use [http://xmlrpc.scripting.com/default.html XML-RPC] over HTTPS. It is straightforward to make XML-RPC calls using your GPO Clearinghouse experimenter certificate.
= Calling get_version =
1. Use the [https://portal.geni.net GPO Portal] to access your experimenter certificate. If you don't already have an account on the GPO Clearinghouse, follow the instructions to access the portal or request an account.
1. Go to the [https://portal.geni.net/secure/profile.php profile page], select the "SSL" tab, and either create or download your certificate.
a. The downloaded file will contain a private key and a certificate
1. Create a file called `get_version.xml` that contains an XML-RPC invocation of the `get_version` API method which takes no parameters:
{{{
#!xml
get_version
}}}
1. Use curl to call get_version at the GPO Clearinghouse Slice Authority:
{{{
curl -H "Content-type: text/xml" --cert geni-username.pem --data @get_version.xml https://ch.geni.net/SA
}}}
1. Other authorities also respond to `get_version` so the same call can be made to the Member Authority by changing the URL:
{{{
curl -H "Content-type: text/xml" --cert geni-username.pem --data @get_version.xml https://ch.geni.net/SA
}}}
1. The Service Registry does not require client authentication so it can be called without an experimenter certificate:
{{{
curl -H "Content-type: text/xml" --data @get_version.xml https://ch.geni.net:8444/SR
}}}
= Responses =
Responses from the [wiki:UniformClearinghouseAPIV2 Uniform Clearinghouse API] always have three values: `code`, `value`, and `output`.
* '''code''' is an integer that indicates the status of the invocation. Zero means success. Any other value is an error code.
* '''value''' holds the actual data of the return if '''code''' is zero.
* '''output''' holds a user readable error message if '''code''' is non-zero.
Here is the response from the Service Registry to the get_version call after [http://xmlprettyprint.com/ pretty printing]:
{{{
#!xml
output
code
0
value
API_VERSIONS
2.0
https://ch.geni.net:8444/SR/
SERVICE_TYPES
IRODS
PROJECT_AUTHORITY
AUTHORIZATION_SERVICE
CERTIFICATE_AUTHORITY
KEY_MANAGER
CREDENTIAL_STORE
MEMBER_AUTHORITY
SLICE_AUTHORITY
PGCH
AGGREGATE_MANAGER
LOGGING_SERVICE
WIMAX_SITE
IMPLEMENTATION
code_version
360c1c8c63cefac33aed5237bb422e4d9de14ed4
code_url
http://trac.gpolab.bbn.com/chapi
site_update_date
2014-02-13 12:02:35.590788
code_release_date
2014-02-13 12:02:35.590788
FIELDS
_GENI_SERVICE_CERT_FILENAME
OBJECT
SERVICE
TYPE
STRING
_GENI_SERVICE_ID
OBJECT
SERVICE
TYPE
INTEGER
VERSION
2.0
SERVICES
SERVICE
}}}
= MA.lookup("Member")... =
Here is a more complicated method call:
{{{
#!xml
lookup
MEMBER
match
MEMBER_URN
urn:publicid:IDN+ch-tm.gpolab.bbn.com+user+USERNAME
}}}