Node tooling for Parse.com
Fathom is a Node.js command line application that communicates with Parse using the REST API.
```
~ npm install -g fathom
Create a .fathomrc file at the root directory of your project:
``
{
"restapi": "[ REST API key ]",
"appid": "[ Application ID ]",
"apiurl": "https://api.parse.com",
"apiversion": 1
}
`
~ fathom -h
Usage: fathom [options]
Options:
-h, --help output usage information
-V, --version output the version number
-p, --path [String] Required: request path
-m, --method [GET|POST|DELETE] Optional: request method, defaults to "GET"
-d, --data [String] Optional: request payload, JSON String or path to JSON file.
`
Fathom uses Parse import data format, read more about it here.
``
fathom -m POST -p classes/MyClass -d '{"results": [{"name":"My First Object"}]}'
data.json:
``
{
"results":
[
{
"name": "My First Object"
}
]
}
Then:
`
~ fathom -m POST -p classes/MyClass -d data.json
{
"createdAt": "2014-02-16T12:59:25.869Z",
"objectId": "ik9DjkW8kH"
}
`
Internally implemented using using a batch operation
data.json
``
{
"results":
[
{
"name": "My First Object"
},
{
"name": "My Second Object"
},
{
"name": "My Third Object"
}
]
}
Then:
`
~ fathom -m POST -p classes/MyClass -d data.json
[
{
"success": {
"createdAt": "2014-02-16T13:08:44.275Z",
"objectId": "u9Y4JBVaks"
}
},
{
"success": {
"createdAt": "2014-02-16T13:08:44.303Z",
"objectId": "5jTwudV7zk"
}
},
{
"success": {
"createdAt": "2014-02-16T13:08:44.319Z",
"objectId": "qC60wI5Fel"
}
}
]
`
`
~ fathom -m GET -p classes/MyClass/u9Y4JBVaks
{
"createdAt": "2014-02-16T13:08:44.275Z",
"name": "My First Object",
"objectId": "u9Y4JBVaks",
"updatedAt": "2014-02-16T13:08:44.275Z"
}
`
`
~ fathom -m GET -p classes/MyClass
{
"results": [
{
"name": "My First Object",
"createdAt": "2014-02-16T13:08:44.275Z",
"updatedAt": "2014-02-16T13:08:44.275Z",
"objectId": "u9Y4JBVaks"
},
{
"name": "My Second Object",
"createdAt": "2014-02-16T13:08:44.303Z",
"updatedAt": "2014-02-16T13:08:44.303Z",
"objectId": "5jTwudV7zk"
},
{
"name": "My Third Object",
"createdAt": "2014-02-16T13:08:44.319Z",
"updatedAt": "2014-02-16T13:08:44.319Z",
"objectId": "qC60wI5Fel"
}
]
}
`
`
~ fathom -m DELETE -p classes/MyClass/u9Y4JBVaks
{}
`
Internally implemented using using a batch operation
data.json
``
{
"results": [
{
"objectId": "5jTwudV7zk"
},
{
"objectId": "qC60wI5Fel"
}
]
}
Then:
`
~ fathom -m DELETE -p classes/MyClass -d data.json
[
{
"success": true
},
{
"success": true
}
]
`
Internally implemented using using a batch operation
`
~ fathom -m DELETE -p classes/MyClass
[
{
"success": true
},
{
"success": true
},
{
"success": true
}
]
`
Given you already know `objectId`, you can create a data.json file:
``
{
"results":
[
{
"message": "hello"
}
]
}
Then:
`
~ fathom -m PUT -p classes/MyClass/ik9DjkW8kH -d data.json
{
"updatedAt": "2014-03-01T14:22:45.103Z"
}
`
All the operations that take a JSON file as argument can take inline JSON as well:
``
~ fathom -m PUT -p classes/MyClass/8eccnwrv7L -d '{"results": [{"message":"hello"}]}'
It is possible to pass the Parse master key in your requests. This is necessary when deleting or updating users without a login session. Using the flag -M or --master the master key on your config file will be passed along your request:
``
~ fathom -M -m PUT -p users/KvFII6hObe -d data.json
or
``
~ fathom --master -m PUT -p users/KvFII6hObe -d data.json
``
~ fathom -m POST -p users -d data.json
_Note:_ Creating multiple users at once is not supported.
``
~ fathom -m GET -p users/KvFII6hObe
``
~ fathom --master -m DELETE -p users/KvFII6hObe
_Note:_ Deleting multiple users at once is not supported.
``
~ fathom --master -m PUT -p users/KvFII6hObe -d data.json
- 0.1 (Released):
- GET, POST, DELETE on `classes`
- 0.2 (Released):
- PUT on classes
- 0.3 (Released):
- Master key on configuration
- POST, PUT, GET, DELETE on `users`
- 0.4:
- query strings
- Session tokens
- GET on `login``
- GET on users/me``
- POST, PUT, GET, DELETE on roles`
- date: 2014-15-18
- changes:
- readme.md
- new --master -M flag allows to pass the master key on requests`
- POST, PUT, GET and DELETE on users`
- date: 2014-03-01
- changes:
- PUT on classes
- date: 2014-02-16
- changes:
- readme.md
- date: 2014-02-16
- changes:
- removing -o --objectid from CLI API
- changing data input format to match parse import format
- allowing inline JSON input for -d --data
- date: 2014-02-12
- changes:
- GET, POST, DELETE on `classes``
- CLI API
- CLI help