This is the pacifica metadata API.
This service provides metadata for all objects and relationships between the objects that the other components want to share between themselves.
docker pull pacifica/metadata
docker-compose up
Install the dependencies using pip (or some other similar python way).
pip install -r requirements.txt
Run the code.
python MetadataServer.py
There are many different types of objects that all get queried and created the same way. We will only show the user object interface here but there are more covered in the [metadata model] (METADATA_MODEL.md) docs.
To create an object issue an HTTP PUT request.
{
"_id": 127,
"first_name": "John",
"last_name": "Doe",
"network_id": "guest"
}
Then put the file.
curl -X PUT -T foo.json http://localhost:8121/users
To get the object just created issue an HTTP GET request.
curl http://localhost:8121/users?_id=127
{
"updated": 1459204793,
"last_name": "Doe",
"created": 1459204793,
"deleted": 0,
"first_name": "John",
"network_id": "guest",
"_id": 127
}
Optionally query on any other parts of the object.
curl http://localhost:8121/users?last_name=Doe&first_name=John
{
"updated": 1459204793,
"last_name": "Doe",
"created": 1459204793,
"deleted": 0,
"first_name": "John",
"network_id": "guest",
"_id": 127
}
To update the object with new data use the get args to identify the object and post data to update the attributes of the object.
{
"network_id": "jdoe"
}
Issue the POST
curl -X POST -T update.json 'http://localhost:8121/users?last_name=Doe&first_name=John'
Get the object to make sure it stuck.
{
"updated": 1459205143,
"last_name": "Doe",
"created": 1459204793,
"deleted": 0,
"first_name": "John",
"network_id": "jdoe",
"_id": 127
}
Notice the updated field did change to the current time when the POST happened.
To delete the object issue an HTTP DELETE request.
curl -X DELETE 'http://localhost:8121/users?_id=127'
Notice the deleted field is set on the object but the object isn't really deleted.
curl http://localhost:8121/users?_id=127
{
"updated": 1459205143,
"last_name": "Doe",
"created": 1459204793,
"deleted": 1459205341,
"first_name": "John",
"network_id": "jdoe",
"_id": 127
}
Contributions are accepted on github via the fork and pull request workflow. Github has a good [help article] (https://help.github.com/articles/using-pull-requests/) if you are unfamiliar with this method of contributing.