Using the RESTAPI to manage schema

Description

I am trying to use the rest api to add a field to a collection in weaviate. It fails with the message below. I am using Postman to add a property to the database

The exception happens when I issue the command below. I have tried multiple combinations without success. It always return the same name. The collection is called “Core” , I want to add the “folder” property.

Is it possible to change a collection using the REST API ?

POST localhost:8080/v1/schema/Core/properties
<— the body —>
‘{
“name”: “folder”,
“dataType”: [“text”],
“description”: “release is a grouping to enable multiple execution”,
“moduleConfig”: {},
“indexInverted”: true,
“indexFilterable”: true,
“indexSearchable”: true,
“indexRangeFilters”: true,
“tokenization”: “word”
}’

<---- Response —>>

{
“error”: [
{
“message”: “property must contain name”
}
]
}

Server Setup Information

  • Weaviate Server Version: “1.26.1”
  • Deployment Method:
  • Multi Node? Number of Running Nodes: 1
  • Client Language and Version: Postman http
  • Multitenancy?: N

Any additional Information

GET localhost:8080/v1/schema #works perfectly.

hi!

Welcome to our community :hugs:

Can you check if this still happen on 1.26.17 (the latest for this release)?

This has worked for me on 1.29:

client.collections.delete("Test")
collection = client.collections.create(
    "Test",
    properties=[
        wvc.config.Property(name="prop1", data_type=wvc.config.DataType.TEXT)
    ]
)

now, creating a second property:

curl --request POST \
  --url http://localhost:8080/v1/schema/Test/properties \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: insomnia/8.6.0' \
  --data '{
"name": "folder",
"dataType": ["text"],
"description": "release is a grouping to enable multiple execution",
"moduleConfig": {},
"indexFilterable": true,
"indexSearchable": true,
"indexRangeFilters": false,
"tokenization": "word"
}'

Let me know if that helps!

Thanks, it helped. In fact, I was using graphql with postman, instead of raw data for schemas. It works now. When I saw your post, I realized the mistake I was committing.

1 Like

Oh I see. That happens quite often.

the Graphql is a readonly api. For any write/update operation, it need to be done using REST or GRPC.

Glad to know your are now unblocked!

Happy coding :slight_smile: