7digital / 7digital-api Goto Github PK
View Code? Open in Web Editor NEW7digital API client for node.js
Home Page: http://www.7digital.com/
License: ISC License
7digital API client for node.js
Home Page: http://www.7digital.com/
License: ISC License
This will ensure they are always working.
Add bluebird as an optional dependency and promisify the action methods if it is installed.
I have a express-angular app where I'd like to add songs to user's lockers. Is there a way to create 7digital accounts for people who are not signed up? Can I create a 7digital account for users programmatically or do I have to link them to some 7digital signup page?
I'm looking through the project and I don't see the methods show on the User Management API.
Beyond User.getLocker, I don't see methods like User.signup, User.details, and User.create.
It could be that they are there and I didn't find them, so please let me know if that is the case. Thanks so much for the help!
By default the API wrapper now returns XML, the mime type however is still set to application/json. This needs to be changed based on the selected reponsse format.
Have a look at the example in node-github and see if the client library they're using supports URL signing method (OAuth v1)
Hi 7digital-api team,
I recently got an odd error not seen before and I'm runningthe 7digital-api module version 0.34.2.
{
"name": "OAuthError",
"message": "OAuth authentication error: Access to resource denied: /1.2/artist/match/byId",
"response": "OAuth authentication error: Access to resource denied"
}
Is this something I should speak with 7digital's client operations team about? Or is it a module error?
Thanks,
Daniel
This is the only place where the API returns an element with attributes and text, so there is no need for cleaners.renameTextNodes
to be generic.
Hey Raoul!
Quick question: now that the 7Digital API is providing JSON output for parts of the catalogue API, does the module now support the updated data schema's or does it still just parse XML to JSON?
The reason I say this is because now the module is doing unnecessary parsing, as of my version 0.34.2. I'm just curious if there are plans to resolve this issue, so that the module can perform more efficiently.
Thanks,
Daniel
We need to parse the ISO8601 date string on the date fields.
I've upgraded to 0.22.0 and I'm able to successfully create third party accounts as well as view a User's locker. But when I try to purchase a song or register a credit card via the third party management I get a response like:
{
"statusCode": "401",
"data": "OAuth authentication error: Access to resource denied"
}
My get url is like the following for purchasing song:
https://api.7digital.com/1.2/user/purchase/priceditem?userId=1&releaseId=34410136&price=0.99&country=XX&oauth_consumer_key=XXXXXX
For adding a card via 7Digital here is my post endpoint:
https://api.7digital.com/1.2/user/payment/cardregistration
and fake test data:
userId=1&country=XX&cardNumber=4111111111111111&cardType=VISA&cardHolderName=Joe%20User&cardStartDate=201212&cardExpiryDate=201812&cardVerificationCode=000&cardPostCode=02912&cardCountry=GB
I wish I could be more specific on what exactly is causing my request to be denied (as opposed to responding with an error code response like 3002: The user has no card details saved
. I know that this has little to do with this NodeJS module and more to do with the API. I contacted 7Digital and the confirmed that I should have access to this endpoint so I'm left scratching my head.
Note: I haven't set up SSL on test server yet so that could be the issue (but I don't believe that is the case since I was able to create users and see their lockers without https).
Thanks so much for your time! You've been so helpful!
When selecting JSON as the preferred response format the xml namespace attributes are also converted into the JSOn, this noise should be removed
Currently we are using my fork of the xml2js library and I'm doing the XML attribute merging there, this would be better done in the ResponseParser. When this is moved there, we can remove the submodule and go back to using the xml2js from npm.
Note that the attribute merging must be done recursively. We could prefix the attributes with the element names to reduce the chances of collisions. That said there are no collisions in the XML returned from the 7digital API as it stands. Either way, the attribute merging must be a "deep" merge, I.E. walking down the object graph.
Returning both xml and json is sucky. It wastes bandwidth if you're transferring it over the wire and you're unlikely to want both.
I was made aware yesterday that the 7Digital API will now be supporting Musicbrainz IDs. This will allow us to be able to access artists with sevenDigitalids=
OR musicBrainzIds=
Example calls are laid out below:
I understand that it will take time to develop and implement this new schema to this Node.js client (and I bet that 7Digital is still iterating on its first release of this data). My question is, when do you all plan on supporting this?
Thanks so much!
Daniel
Hi,
I wonder if this repo is the best starting point, boilerplate, if I want to learn more about your services by coding?
If not, do you know any other you recommend?
Cheers
How to I determine which release have previews available when doing
const releases = new api.Releases();
releases.getTopByTags({ tags: 'electronic'})
Is there a way to only get release with previews to be play from https://previews.7digital.com/clip/${id}
see conversation in #76
I have filled out information at https://www.7digital.com/contact/ , but no one has contacted me. How can I quickly apply for an API key?
From what I can tell the project currently supports track previews but not full track streaming as part of the Streaming API.
Does (or will) this project provide support for the 7Digital streaming API?
Thanks!
buildFromFile takes in split options. This makes modifying cumbersome, we should just pass the options object around.
at least for me examples aren't working
should I report an issue or repo has been abounded?
Please see: http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/
I think that it should look like:
language: node_js
node_js:
- 0.4
- 0.6
notifications:
email:
- [email protected]
- [email protected]
before_script: "git submodule update --init --recursive"
defaultParams
and add them in request.dispatch
and request.dispatchSecure
This is not precise enough, they should be called consumerkey and consumer secret throughout
This seems to be an underlying problem with xml2js. The maintainer is looking at the issue here: Leonidas-from-XIV/node-xml2js#113 which is worth keeping an eye on. There is an integration test for this case marked as pending.
Hi. So just started taking a look at 7digital API and your wrapper. From what I can tell it's not using the new streaming api.
http://developer.echonest.com/forums/thread/1425
When I use this library I get the following error:
{ [ApiHttpError: OAuth authentication error: Access to resource denied]
name: 'ApiHttpError',
statusCode: 401,
response: 'OAuth authentication error: Access to resource denied',
message: 'OAuth authentication error: Access to resource denied' }
We need to have the ~/catalogue/log
endpoint to report radio streaming activity as this is a requirement of the labels.
Right now when I look at the latest API Schema I do not see this method as part of the module.
Documentation on this particular logging method can be found here.
If this method just requires OAuth signing then can just take care of implementing it similar to the previews, streaming, and downloading tracks methods?
Here is what I mean as an example, using your README.md:
var api = require('7digital-api').configure({
consumerkey: 'YOUR_KEY_HERE',
consumersecret: 'YOUR_SECRET_HERE',
defaultParams: {
country: 'es'
}
});
var oauth = new api.OAuth();
var previewUrl = oauth.sign('http://previews.7digital.com/clip/12345');
// For access to locker / subscription streaming without managed users you
// will need to provide the accesstoken and secret for the user
var signedUrl = oauth.sign('https://stream.svc.7digital.net/stream/locker', {
trackId: 1234,
formatId: 26,
accesstoken: 'ACCESS_TOKEN',
accesssecret: 'ACCESS_SECRET'
});
// Requesting this URL will now respond with the media data (or redirect to
// an error).
Let me know and thank you!
Daniel
Implement an optional pluggable cache (maybe using redis or memcached) which can be supplied in the wrapper options and honours the caching headers returned by the API.
There is overhead in parsing the XML. This can have a significant performance impact when making lots of large requests. E.g. fetching large lockers.
Caching would be better done with something like varnish now that the cache headers are all correct and sensible on the API.
We flatten the nested basketItems in the cleaners but not for any other nested collections. We should standardise as it a) simplifies ensureCollections
b) keeps responses closer to the dev docs.
We're getting an error using the client every time a request hits our server (incidentally it looks like it's a request for the favicon).
TypeError: Cannot read property 'headers' of undefined
at getLocationForRedirectsAndCallback (/home/dave/dev/code/webstore/node_modules/7digital-api/lib/resource.js:128:17)
at validateAndCleanResponse (/home/dave/dev/code/webstore/node_modules/7digital-api/lib/responseparser.js:156:10)
at Parser.<anonymous> (/home/dave/dev/code/webstore/node_modules/xml2js/lib/xml2js.js:384:20)
at Parser.emit (events.js:95:17)
at Object.onclosetag (/home/dave/dev/code/webstore/node_modules/xml2js/lib/xml2js.js:348:26)
at emit (/home/dave/dev/code/webstore/node_modules/xml2js/node_modules/sax/lib/sax.js:615:33)
at emitNode (/home/dave/dev/code/webstore/node_modules/xml2js/node_modules/sax/lib/sax.js:620:3)
at closeTag (/home/dave/dev/code/webstore/node_modules/xml2js/node_modules/sax/lib/sax.js:861:5)
at Object.write (/home/dave/dev/code/webstore/node_modules/xml2js/node_modules/sax/lib/sax.js:1294:29)
at exports.Parser.Parser.parseString (/home/dave/dev/code/webstore/node_modules/xml2js/lib/xml2js.js:403:31)
Not sure why the response is null, but that case should probably be handled.
The version of Lodash currently used has two security vulnerabilities (1 low, 1 moderate). Upgrading should be a non-breaking change.
API clients restricted by country have no way to supply a country code when requesting a request/access token. This effectively makes it impossible to do oauth without rolling your own oauth helper.
The node-jasmine library is a bit hacky, and doesn't use a recent version of jasmine. Remove the git submodule, the specs.js file and add jessie as a pacakge dependency and use node-fu. Should be straightforward - might need to rename all the spec files to have _spec.js as their suffix to work.
Hey so I updated to 0.19.0. Thanks for that! While it has cleaned up my OAuth code (since now it just uses the default params) I can't seem to get an access token now. Before (as of 0.17.0) I was able to successfully get a request token, authorize via account.7digital.com, go to the callback url, and then generate an access token. With the 0.19.0 version, my code stops when getting an access token. I get a
{ "statusCode": "401",
"data": "OAuth authentication error: Access to resource denied" }
I feel it has to do with the global country code parameter, even though I see it being included in your function definition.
I wish I could get a more specific error so that I could figure out why I can't authenticate now. Thanks again for your help!
May need to be split into several issues:
When i do:
tracks = new api.Tracks();
tracks.getPreview({ trackId: 1322 }, function(err, data) {
console.dir(data);
});
it returns:
{ head: { title: 'Object moved' },
body: { h2: { '#': 'Object moved to .', a: [Object] } } }
{ status: 'ok',
version: '1.2',
url: 'http://previews.7digital.com/clips/826/1322.clip.mp3' }
I guess it is not following the redirect header.
This capability changes the behaviour of some normally 3-legged endpoints, making them 2-legged. We need to think about a nice, simple way to do this transparently for the consumer (e.g. via options) and then change the internal behaviour when making the request. Obviously we'll also have to add the user/signup endpoint to the schema too and document both journeys.
The build call does not set the format and logger when building an API with a JSON string
The format currently named JSON is actually a JavaScript object. Implementing JSON should be as trivial as stringifying.
I'm currently working with your API and would love to hear what is the best way to change the country code on your project on a global basis so that all requests use it correctly?
If possible it would be great if you all could commit the changes on this github project so that it can be solved for future instances of this problem.
This is critical for us to access the premium aspect of the API since our API's access is matched to a specific country code. Thanks so much!
When refactoring the sign helper to allow 3-legged signing, I inadvertently made the parameters argument required.
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.