Skip to content

Commit

Permalink
Add docs for /project/NAME/resources and update /refresh info
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Apr 25, 2011
1 parent 34a8aa5 commit 680e31d
Showing 1 changed file with 82 additions and 3 deletions.
85 changes: 82 additions & 3 deletions docs/en/09-api/01-chapter10.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,92 @@ If the project defines a Resource Model Provider URL, then the additional items
<providerURL>URL</providerURL>
</resources>

### Updating Resources for a Project
### Updating and Listing Resources for a Project

Update the resources for a project via its Resource Model Provider URL.
Update or retrieve the Resources for a project. A GET request returns the resources
for the project, and a POST request will update the resources.

URL:

/project/NAME/updateResources
/project/NAME/resources

Method: POST, GET

#### POST request

POSTing to this URL will set the resources for the project to the content of the request.

Expected POST Content: either `text/xml` or `text/yaml` Content-Type containing the
Resource Model definition in [resources-v10(5)](resources-v10.html) or [resources-v10-yaml(5)](resources-v10-yaml.html) formats as the request body. (Note: any MIME type ending with '/yaml' or '/x-yaml' or '/xml' will be accepted).

POST Result: A success or failure API response. (See [Response Format](#response-format)).

Example POST request:

POST /api/1/project/test/resources
Content-Type: text/yaml

node1:
hostname: node1
username: bob

node2:
hostname: node2
username: bob

Result:

200 OK

<result success="true">
<success>
<message>Resources were successfully updated for project test</message>
</success>
</result>

#### GET request

Optional GET Parameters:

* `format` : Result format. One of "xml" or "yaml". Default is "xml".
* Query
parameters can also be used. This is an alternate interface to [Listing Resources](#listing-resources).

GET Result: Depending on the `format` parameter, a value of "xml" will return [resources-v10(5)](resources-v10.html) and "yaml" will return [resources-v10-yaml(5)](resources-v10-yaml.html) formatted results.

Example GET request:

GET /api/1/project/test/resources

Response:

200 OK
Content-Type: text/xml

<project>
<node name="node1" hostname="node1" username="bob" />
<node name="node2" hostname="node2" username="bob" />
</project>

### Refreshing Resources for a Project

Refresh the resources for a project via its Resource Model Provider URL. The URL can be
specified as a request parameter, or the pre-configured URL for the project
can be used.

URL:

/project/NAME/resources/refresh

Method: POST

Optional Parameters:

`providerURL`

: Specify the Resource Model Provider URL to refresh the resources from. If
not specified then the configured provider URL in the `project.properties`
file will be used.

Result: A success or failure result with a message.

Expand Down

0 comments on commit 680e31d

Please sign in to comment.