e1db68f194
Several API sample files under doc/api_samples/ contained literal curl
commands instead of JSON request bodies, despite having .json file
extensions. This caused the api-ref documentation to render curl
command syntax with incorrect syntax highlighting (JavaScript or
default) instead of showing the actual JSON request payload.
Additionally, the attributes-post-curl.json file had a syntax error
with a missing closing brace in the embedded JSON.
Replace the curl command files with proper JSON request body files,
rename them from *-curl.json to *-req.json to match the existing
*-resp.json naming convention, and update the api-ref .inc files
to use consistent headings ("Example request:" instead of "Example
post curl") and add :language: javascript where it was missing.
Closes-Bug: #2158147
Assisted-by: Claude claude-opus-4-6 claude-code-2.1.190
Change-Id: I3b118051cb165c01ebefe8b8cecb9be9fc694827
Signed-off-by: melanie witt <melwittt@gmail.com>
113 lines
2.5 KiB
ReStructuredText
113 lines
2.5 KiB
ReStructuredText
.. -*- rst -*-
|
|
.. needs:body_verification
|
|
|
|
Attributes
|
|
++++++++++
|
|
|
|
Lists, shows details, creates and deletes for attributes.
|
|
|
|
A `attribute` represents the trait of a physical card like FPGA or GPU.
|
|
|
|
List Attributes
|
|
---------------
|
|
|
|
.. rest_method:: GET /v2/attributes
|
|
|
|
Lists UUID, deployable_id, key, value and more information for all devices.
|
|
|
|
Normal response codes: 200
|
|
|
|
Error response codes: unauthorized(401), forbidden(403)
|
|
|
|
Request
|
|
=======
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- attribute_request_depid: attribute_request_depid
|
|
|
|
Response
|
|
========
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- attributes: attributes
|
|
- uuid: attribute_uuid_resp
|
|
- id: attribute_id_resp
|
|
- deployable_id: attribute_deployable_id_resp
|
|
- key: attribute_key_resp
|
|
- value: attribute_value_resp
|
|
- created_at: created
|
|
- updated_at: updated
|
|
- links: links
|
|
|
|
**Example response: list all attributes**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/attributes/attributes-list-resp.json
|
|
:language: javascript
|
|
|
|
|
|
Get One Attribute
|
|
-----------------
|
|
|
|
.. rest_method:: GET /v2/attributes/{attribute_uuid}
|
|
|
|
Gets the UUID, id, deployable_id, key, value and more information for one attribute with the specified UUID.
|
|
|
|
Normal response codes: 200
|
|
|
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403), notfound(404)
|
|
|
|
Request
|
|
=======
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- attribute_uuid: attribute_request_uuid
|
|
|
|
Response
|
|
========
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- uuid: attribute_uuid_resp
|
|
- id: attribute_id_resp
|
|
- deployable_id: attribute_deployable_id_resp
|
|
- key: attribute_key_resp
|
|
- value: attribute_value_resp
|
|
- created_at: created
|
|
- updated_at: updated
|
|
- links: links
|
|
|
|
**Example response: show details of a specific attribute**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/attributes/attributes-getone-resp.json
|
|
:language: javascript
|
|
|
|
Create Attributes
|
|
-----------------
|
|
|
|
.. rest_method:: POST /v2/attributes
|
|
|
|
Creates an attribute. The payload should have the following field:
|
|
|
|
Request
|
|
=======
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- deployable_id: attribute_deployable_id_req
|
|
- key: attribute_key_req
|
|
- value: attribute_value_req
|
|
|
|
**Example request: create an attribute**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/attributes/attributes-post-req.json
|
|
:language: javascript
|
|
|
|
**Example response: create an attribute**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/attributes/attributes-create-resp.json
|
|
|
|
Delete One Attribute by uuid
|
|
----------------------------
|
|
|
|
.. rest_method:: DELETE /v2/attributes/{attribute_uuid}
|
|
|
|
Delete an attribute. No query parameters required.
|