Create a resource and its first revision
POST
/api/v1/resources
const url = 'https://example.com/api/v1/resources?projectId=00000000-0000-0000-0000-000000000000';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"example","slug":"example","description":"example","setup":{"sh":"example"},"teardown":{"sh":"example"},"exports":["example"],"parameters":[{"name":"example","description":"example","required":false,"default":"example","example":"example"}],"creator":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://example.com/api/v1/resources?projectId=00000000-0000-0000-0000-000000000000' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "slug": "example", "description": "example", "setup": { "sh": "example" }, "teardown": { "sh": "example" }, "exports": [ "example" ], "parameters": [ { "name": "example", "description": "example", "required": false, "default": "example", "example": "example" } ], "creator": "example" }'Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ” projectId
required
Project scope. Required on scoped list and root-create operations; requests without a resolvable project are rejected with 400. There is no default project.
string
Project scope. Required on scoped list and root-create operations; requests without a resolvable project are rejected with 400. There is no default project.
Request Body
Section titled “Request Body ” Media type application/json
object
name
required
string
slug
string
description
string
setup
required
object
sh
string
teardown
object
sh
string
exports
Array<string>
parameters
Array<object>
object
name
required
string
description
string
required
boolean
default
string
example
string
creator
string
Responses
Section titled “ Responses ”Success
Invalid input
Resource slug or revision ref already exists in this project