I'm able to create a new schema using the MeshRestClient, and get a successful response back.
Although, just after that, I try to create a node using the schema and I get an exception about missing the referenced schema.
Log output from creating a schema -
12:30:13.177 [] INFO [vert.x-worker-thread-9] [JULLogDelegate.java:167] - 127.0.0.1 - POST /api/v1/schemas/f0ee56b03d514a5fae56b03d519a5f04 HTTP/1.1 201 835 - 20 ms
12:30:13.179 [] INFO [main] [MeshService.java:81] - created schema - uuid: f0ee56b03d514a5fae56b03d519a5f04, name: form_definition
Then when creating a new node using that schema reference -
Caused by: com.gentics.mesh.rest.client.MeshRestClientMessageException: Error:404 in POST /api/v1/demo/nodes : Not Found Info: Object with uuid "f0ee56b03d514a5fae56b03d519a5f04" could not be found.
I tried setting the schema name and the schema reference in the NodeCreateRequest, but both complain.
public MeshRequest<NodeResponse> saveFormDefinition(Map<String, Object> form) {
NodeCreateRequest nodeCreateRequest = new NodeCreateRequest()
.setSchema(formDefinitionSchema.toReference())
.setLanguage("en")
.setParentNodeUuid(formsFolderNode);
String formName = (String)form.get("name");
nodeCreateRequest.getFields().putString("name", formName);
return this.client.createNode(this.meshProjectName, nodeCreateRequest);
}
Is there a time period I need to wait before it's available? Or any other thoughts?
Thanks!
The problem was that I never subscribed to the assignSchemaToProject request -
client.assignSchemaToProject(meshProjectName, response.getUuid())
So after I subscribed, the request was executed and now available for the CreateNodeRequest.
client.assignSchemaToProject(meshProjectName, response.getUuid()).blockingGet();