Skip to content
Mo Morsi edited this page Jan 10, 2013 · 2 revisions

Providers

Create a new provider

Request

curl -X POST --user admin:password--header “Accept: application/xml”  --header “Content-Type: application/xml” -k  https://localhost/conductor/api/providers --data 
  "<provider>
  <name>providername</name>
  <provider_type id='1' />
  <url>[http://localhost:3002/api](http://localhost:3002/api)</url>
  </provider>" 

Response

if success

http status 201 Created

<provider href='http://localhost/conductor/api/providers/1' id='1'>
 <name>providername</name>
 <url>[http://localhost:3002/api](http://localhost:3002/api)</url>
 <provider_type>mock</provider_type>
 <deltacloud_provider></deltacloud_provider>
</provider>

if failure

http status 422 Unprocessable Entity - for validation errors

<errors>
  <error>
    <message>Provider name has already been taken</message>
  </error>
</errors>

List all providers

Request

curl -X GET --user admin:password --header "Accept: application/xml" --header "Content-Type: application/xml" -k  https://localhost/conductor/api/providers

Response

<providers>
  <provider href='http://localhost/conductor/api/providers/7' id='7'>
  </provider>
  <provider href='http://localhost/conductor/api/providers/1' id='1'>
  </provider>
  <provider href='http://localhost/conductor/api/providers/2' id='2'>
  </provider>
  <provider href='http://localhost/conductor/api/providers/4' id='4'>
  </provider>
  <provider href='http://localhost/conductor/api/providers/6' id='6'>
  </provider>
</providers>

Show a single provider’s details

Request

curl -X GET --user admin:password --header "Accept: application/xml" --header "Content-Type: application/xml" -k  https://localhost/conductor/api/providers/1

Response

if requested provider exists

http status 200 OK

<provider href='http://localhost/conductor/api/providers/1' id='1'>
  <name>mock 1</name>
  <url>http://localhost:3002/api</url>
  <provider_type>mock</provider_type>
  <deltacloud_provider></deltacloud_provider>
</provider>

if requested provider does not exist

http status 404 Not Found

<code><error>
  <code>RecordNotFound</code>
  <message>Couldn't find Provider with ID=1</message>
</error>
</code>

Update a provider

Request

curl -X PUT --user admin:password --header "Accept: application/xml" --header "Content-Type: application/xml" -k 
https://localhost/conductor/api/providers/1 
--data "
<provider>
<name>providername</name>
<provider_type id='1' />
<url>http://localhost:3002/api</url>
</provider>"

Response

If success,

http status 200 OK

Same as show details

If failure,

http status 422 Unprocessable Entity - for validation errors

<errors>
  <error>
    <message>Provider name has already been taken</message>
  </error>
</errors>

Delete a provider

Request

curl -X DELETE --user admin:password --header "Accept: application/xml" --header "Content-Type: application/xml" -k  https://localhost/conductor/api/providers/1

Response

If success,

http status 204 No Content

There is no body response - only http status in headers.

If failure,

http status 404 Not Found for non existing provider

<code><error>
  <code>RecordNotFound</code>
  <message>Couldn't find Provider with ID=8</message>
</error></code>
Clone this wiki locally