To make it work again, add a type definition via the alter endpoint. Let’s assume the node in the previous example represents a person. Then, the basic Person type could be defined as follows:
type Person {
name: string
age: int
}
I have tried:
curl localhost:8080/alter -d '{type Person {
name: string
age: int
}
}'
and:
curl localhost:8080/alter -d {type Person {
name: string
age: int
}
}
and:
curl localhost:8080/alter -d 'type Person {
name: string
age: int
}
'
-d/–data
(HTTP) Sends the specified data in a POST request to the HTTP server, in a way that can emulate as if a user has filled in a HTML form and pressed the submit button. Note that the data is sent exactly as specified with no extra processing (with all newlines cut off). The data is expected to be &zerosp;“url-encoded”. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to -F/–form. If this option is used more than once on the same command line, the data pieces specified will be merged together with a separating &-letter. Thus, using ‘-d name=daniel -d skill=lousy’ would generate a post chunk that looks like &zerosp;‘name=daniel&skill=lousy’.
If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be url-encoded. Multiple files can also be specified. Posting data from a file named ‘foobar’ would thus be done with --data @foobar".
curl -X POST localhost:8080/alter -d 'type Person {
name: string
}'
{"errors":[{"message":"Schema does not contain a matching predicate for field name in type Person","extensions":{"code":"Error"}}]} **%**
curl -X POST localhost:8080/alter -d \
'name: string @index(term) .
type Person {
name
}'
Note that the error msg says “Schema does not contain a matching predicate for field name” this means you didn’t define the “name” pred before using it.