feat(docs): add package_create

This commit is contained in:
rzmk 2025-12-02 15:17:26 -05:00
parent eb4f68a261
commit 01dcb3b387
2 changed files with 207 additions and 1 deletions

View file

@ -0,0 +1,33 @@
---
title: package_create
full: true
_openapi:
method: POST
route: package_create
toc: []
structuredData:
headings: []
contents:
- content: >
Create a new dataset (package).
You must be authorized to create new datasets. If you specify any
groups for the new dataset, you must also be authorized to edit these
groups.
Plugins may change the parameters of this function depending on the
value of the type parameter, see the `IDatasetForm` plugin interface.
---
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Create a new dataset (package).
You must be authorized to create new datasets. If you specify any groups for the new dataset, you must also be authorized to edit these groups.
Plugins may change the parameters of this function depending on the value of the type parameter, see the `IDatasetForm` plugin interface.
<APIPage document={"./lib/openapi.yml"} operations={[{"path":"package_create","method":"post"}]} webhooks={[]} hasHead={false} />

View file

@ -1449,4 +1449,177 @@ paths:
properties:
user_id:
type: string
description: The user ID or name
description: The user ID or name
package_create:
post:
operationId: package_create
summary: package_create
description: |
Create a new dataset (package).
You must be authorized to create new datasets. If you specify any groups for the new dataset, you must also be authorized to edit these groups.
Plugins may change the parameters of this function depending on the value of the type parameter, see the `IDatasetForm` plugin interface.
requestBody:
required: false
content:
multipart/form-data:
schema:
type: object
properties:
name:
type: string
description: the name of the new dataset, must be between 2 and 100 characters long and contain only lowercase alphanumeric characters, `-` and `_`
title:
type: string
description: "the title of the dataset (default: same as `name`)"
private:
type: boolean
description: "if `True` creates a private dataset"
author:
type: string
description: the name of the dataset's author
author_email:
type: string
description: the email address of the dataset's author
maintainer:
type: string
description: the name of the dataset's maintainer
maintainer_email:
type: string
description: the email address of the dataset's maintainer
license_id:
type: string
description: the id of the dataset's license, see `license_list()` for available values
notes:
type: string
description: a description of the dataset
url:
type: string
description: a URL for the dataset's source
version:
type: string
description: no longer than 100 characters
state:
type: string
description: "the current state of the dataset, e.g. `'active'` or `'deleted'`, only active datasets show up in search results and other lists of datasets, thsi parameter will be ignored if you are not authorized to change the state of the dataset (default: `'active`')"
type:
type: string
description: the type of the dataset, `IDatasetForm` plugins associate themselves with different dataset types and provide custom dataset handling behaviour for these types
resources:
type: array
description: the dataset's resources
items:
type: object
properties:
package_id:
type: string
description: id of package that the resource should be added to
url:
type: string
description: url of resource
description:
type: string
format:
type: string
hash:
type: string
name:
type: string
resource_type:
type: string
mimetype:
type: string
mimetype_inner:
type: string
cache_url:
type: string
size:
type: integer
created:
type: string
last_modified:
type: string
cache_last_updated:
type: string
upload:
type: string
format: binary
tags:
type: array
description: the dataset's tags
items:
type: object
properties:
name:
type: string
description: "the name for the new tag, a string between 2 and 100 characters long containing only alphanumeric characters, spaces and the characters `-`, `_` and `.`, e.g. `'Jazz'`"
vocabulary_id:
type: string
description: "the id of the vocabulary that the new tag should be added to, e.g. the id of vocabulary `'Genre'`"
extras:
type: array
description: "the dataset's extras, extras are arbitrary (key: value) metadata items that can be added to datasets, each extra dictionary should have keys `'key'` (a string), `'value'` (a string)"
items:
type: object
additionalProperties: true
plugin_data:
type: object
description: |
Private package data belonging to plugins. Only sysadmin users may set this value. It should be a dict that can be dumped into JSON, and plugins should namespace their data with the plugin name to avoid collisions with other plugins, e.g.:
```json
{
"name": "test-dataset",
"plugin_data": {
"plugin1": {"key1": "value1"},
"plugin2": {"key2": "value2"}
}
}
```
additionalProperties: true
relationships_as_object:
type: array
description: list of relationship dictionaries
items:
type: object
properties:
subject:
type: string
description: the id or name of the dataset that is the subject of the relationship
object:
type: string
description: the id or name of the dataset that is the object of the relationship
type:
type: string
description: "the type of the relationship, one of `'depends_on'`, `'dependency_of'`, `'derives_from'`, `'has_derivation'`, `'links_to'`, `'linked_from'`, `'child_of'` or `'parent_of'`"
comment:
type: string
description: a comment about the relationship
relationships_as_subject:
type: array
description: list of relationship dictionaries
items:
type: object
properties:
subject:
type: string
description: the id or name of the dataset that is the subject of the relationship
object:
type: string
description: the id or name of the dataset that is the object of the relationship
type:
type: string
description: "the type of the relationship, one of `'depends_on'`, `'dependency_of'`, `'derives_from'`, `'has_derivation'`, `'links_to'`, `'linked_from'`, `'child_of'` or `'parent_of'`"
comment:
type: string
description: a comment about the relationship
groups:
type: array
description: "the groups to which the dataset belongs, each group dictionary should have one or more of the following keys which identify an existing group: `'id'` (the id of the group, string), or `'name'` (the name of the group, string), to see which groups exist call `group_list()`"
items:
type: object
additionalProperties: true
owner_org:
type: string
description: "the id of the dataset's owning organization, see `organization_list()` or `organization_list_for_user()` for available values. This parameter can be made optional if the config option [`ckan.auth.create_unowned_dataset`](https://docs.ckan.org/en/2.11/maintaining/configuration.html#ckan-auth-create-unowned-dataset) is set to `True`."