| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
First, create a new session by uploading your EMF metamodel (.ecore file):
curl -X POST -F "file=@/path/to/your/metamodel.ecore" \
http://localhost:8095/metamodel/startThis will return a response with a sessionId used by subsequent requests:
{
"sessionId": "428e82e8-ab61-4e11-a6fc-b5f76e78ebb8",
"routes": { /* OpenAPI-like summary of endpoints */ }
}To create a new instance of a class in your metamodel:
curl -X POST -H "Content-Type: application/json" \
-d '{
"attribute1": "value1",
"attribute2": "value2",
"reference1": { "nestedAttribute": "nestedValue" },
"multiReference": [
{"nestedAttribute": "item1"},
{"nestedAttribute": "item2"}
]
}' \
http://localhost:8095/metamodel/YOUR_SESSION_ID/YourClassNameNote: With the stateless routes, the POST body is optional; an empty instance is created if omitted.
The server exposes a fixed set of routes that work for any uploaded metamodel. Generic path params let you operate on any class and feature.
Available routes
Example: using uploads/Class.ecore
curl -s -F file=@uploads/Class.ecore \
http://localhost:8095/metamodel/start | tee /tmp/start.json
SESSION_ID=$(sed -n 's/.*"sessionId"[[:space:]]*:[[:space:]]*"\([^\"]*\)".*/\1/p' /tmp/start.json)
echo SESSION_ID=$SESSION_IDcurl -s -X POST \
http://localhost:8095/metamodel/$SESSION_ID/Class | tee /tmp/class_create.json
CLASS_ID=$(sed -n 's/.*"id"[[:space:]]*:[[:space:]]*\([0-9][0-9]*\).*/\1/p' /tmp/class_create.json)
echo CLASS_ID=$CLASS_IDcurl -i -s -X PUT -H "Content-Type: application/json" \
-d '{"value":"MyClass"}' \
http://localhost:8095/metamodel/$SESSION_ID/Class/$CLASS_ID/namecurl -i -s -X DELETE \
http://localhost:8095/metamodel/$SESSION_ID/Class/$CLASS_ID/namecurl -i -s -X DELETE \
http://localhost:8095/metamodel/$SESSION_ID/Class/$CLASS_IDNotes
curl -X POST -H "Content-Type: application/json" \
-d '{
"lastName": "Smith",
"father": {"firstName": "John"},
"mother": {"firstName": "Jane"},
"sons": [{"firstName": "Jimmy"}, {"firstName": "Johnny"}],
"daughters": [{"firstName": "Sally"}]
}' \
http://localhost:8095/metamodel/428e82e8-ab61-4e11-a6fc-b5f76e78ebb8/Family| Back | FazBrowse Home | New Git URL |