tikalk / commandcar Goto Github PK
View Code? Open in Web Editor NEWcurl on steroids
curl on steroids
[Solution: Make sure your call returns a JSON response not an XML one (use format=json
or something similar)]
I'm trying to create an API for last.fm, but I'm getting this error:
SyntaxError: Unexpected token <
at Object.parse (native)
at Request._callback (/usr/local/lib/node_modules/commandcar/main.js:346:21)
at Request.self.callback (/usr/local/lib/node_modules/commandcar/node_modules/request/request.js:198:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.<anonymous> (/usr/local/lib/node_modules/commandcar/node_modules/request/request.js:1035:10)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/commandcar/node_modules/request/request.js:962:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
when I call commandcar
thus:
commandcar lastfm.artist_getSimilar --artist airbag -k myapikey
after a
sudo commandcar load --location ~/projects/commandcar/lastfm
The lastfm
folder contains the api.json
file:
{
"protocol": "https",
"hostname": "ws.audioscrobbler.com/2.0",
"use_options": [
{
"short": "k",
"long": "api_key",
"def": "api_key",
"desc": "api_key",
}
]
}
and a commands
folder inside it with the artist_getSimilar.json
file:
{
"path_template": "/?method=artist.getSimilar&artist={artist}&limit=5&api_key={api_key}",
"ret": "name",
"options": [
{
"short": "a",
"long": "artist",
"def": "artist name",
"desc": "artist",
},
{
"short": "k",
"long": "api_key",
"def": "apikey",
"desc": "access token",
}
]
}
The response I'm getting in the browser, with the following call
https://ws.audioscrobbler.com/2.0/?method=artist.getSimilar&artist=airbag&limit=5&api_key=myapikey
is something like this:
<?xml version="1.0" encoding="UTF-8" ?>
<lfm status="ok"><similarartists artist="Airbag"><artist><name>Nosound</name>
<mbid>797c5264-2edc-4718-b3fc-ee30b343a0fd</mbid>
<match>1</match>
<url>http://www.last.fm/music/Nosound</url>
<image size="small">http://img2-ak.lst.fm/i/u/34s/b7b889567c9245b292ed8fc034edf8ec.png</image>
<image size="medium">http://img2-ak.lst.fm/i/u/64s/b7b889567c9245b292ed8fc034edf8ec.png</image>
<image size="large">http://img2-ak.lst.fm/i/u/174s/b7b889567c9245b292ed8fc034edf8ec.png</image>
<image size="extralarge">http://img2-ak.lst.fm/i/u/300x300/b7b889567c9245b292ed8fc034edf8ec.png</image>
<image size="mega">http://img2-ak.lst.fm/i/u/b7b889567c9245b292ed8fc034edf8ec.png</image>
<image size="">http://img2-ak.lst.fm/i/u/arQ/b7b889567c9245b292ed8fc034edf8ec.png</image>
<streamable>0</streamable>
</artist>
<artist><name>RPWL</name>
<mbid>80301f91-cb5a-4f02-bd2a-ead999a7dc06</mbid>
<match>0.778902</match>
<url>http://www.last.fm/music/RPWL</url>
<image size="small">http://img2-ak.lst.fm/i/u/34s/e3e2a5496af34b64bf3ad02d983986ea.png</image>
<image size="medium">http://img2-ak.lst.fm/i/u/64s/e3e2a5496af34b64bf3ad02d983986ea.png</image>
<image size="large">http://img2-ak.lst.fm/i/u/174s/e3e2a5496af34b64bf3ad02d983986ea.png</image>
<image size="extralarge">http://img2-ak.lst.fm/i/u/300x300/e3e2a5496af34b64bf3ad02d983986ea.png</image>
<image size="mega">http://img2-ak.lst.fm/i/u/e3e2a5496af34b64bf3ad02d983986ea.png</image>
<image size="">http://img2-ak.lst.fm/i/u/arQ/e3e2a5496af34b64bf3ad02d983986ea.png</image>
<streamable>0</streamable>
</artist>
...
</similarartists>
</lfm>
This is a natural follow up to issue #1.
Swagger and RAML seem to be the most used formats for API specification and generation.
Thx
I get this error when I try to install the instagram API:
> sudo commandcar install --api instagram
installing @commandcar/instagram
validateTree - |####################################################################################---------------------------------------------------------------|
/usr/local/lib/node_modules/commandcar/node_modules/npm/lib/install/filter-invalid-actions.js:24
if (pkg.isInLink || pkg.parent.target || pkg.parent.isLink) {
^
TypeError: Cannot read property 'target' of null
at module.exports (/usr/local/lib/node_modules/commandcar/node_modules/npm/lib/install/filter-invalid-actions.js:24:35)
at Array.<anonymous> (/usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
at LOOP (/usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
at /usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/chain.js:18:7
at Object.Installer.computeLinked (/usr/local/lib/node_modules/commandcar/node_modules/npm/lib/install.js:411:41)
at Array.<anonymous> (/usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
at LOOP (/usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
at /usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/chain.js:18:7
at module.exports (/usr/local/lib/node_modules/commandcar/node_modules/npm/lib/install/diff-trees.js:50:3)
at Array.<anonymous> (/usr/local/lib/node_modules/commandcar/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm version 3.3.9, [email protected].
Please ping me if you need more information.
Will this project support GraphQL based APIs?
I like your idea about having API collection, because I'm working on very similar project.
I'm trying to create open catalog of API specification, right now it has 172 specs including all Google services, Trello, Instagram, Spotify, etc.
All specs are validated and also keep in sync with their source, which is official API docs in almost all cases.
But more importantly I have an API and it already used by other projects:
Integration with your tool is very interesting for me.
If you interested and want to discuss it further we can chat in Gitter or you can call me in Skype: ivangon4arov
see: http://swagger.io/
Hello
When I try to load an API with
commandcar load --location ...
I get the following error
12 : Error: rsync exited with code 12
Could you help me ?
Thank you
After installing (npm install -g commandcar), and running commandcar with no arguments I get
error building db: Error: ENOENT, no such file or directory '/usr/local/lib/node_modules/commandcar/node_modules/@commandcar'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.