GithubHelp home page GithubHelp logo

7digital / 7digital-api Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 12.0 1.32 MB

7digital API client for node.js

Home Page: http://www.7digital.com/

License: ISC License

Makefile 2.29% JavaScript 97.57% Vim Script 0.14%

7digital-api's People

Contributors

actionshrimp avatar brainsiq avatar c24w avatar gregsochanik avatar marcbachmann avatar nfroidure avatar raoulmillais avatar scooper91 avatar tonyto avatar willm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

7digital-api's Issues

can I create 7digital accounts for users?

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?

Missing User Management API Methods?

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!

Support the oauth endpoints

Have a look at the example in node-github and see if the client library they're using supports URL signing method (OAuth v1)

Access denied /1.2/artist/match/byId

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

Is this module unnecessarily parsing JSON?

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

Purchasing release and adding credit card data via Partner user account

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!

Merge XML attributes in parser

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.

When will musicbrainz IDs be supported?

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:

With 7Digital ID
http://api.7digital.com/1.2/artist/match/byId?country=us&oauth_consumer_key=YOUR_KEY_HERE&oauth_nonce=989288088&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1426096192&oauth_version=1.0&sevenDigitalIds=10869&oauth_signature=%2F2r4dlCR9RF4JYIhRg78%2BMcd3cQ%3D

With Musicbrainz ID
http://api.7digital.com/1.2/artist/match/byId?country=us&musicBrainzIds=25607613-aceb-445a-8519-83a2ee0f8402&oauth_consumer_key=YOUR_KEY_HERE&oauth_nonce=346135565&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1426096485&oauth_version=1.0&oauth_signature=V7HFzaKSvt0HZLpBzcGvCvUgg%2BA%3D

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

Will you be supporting the Streaming API?

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!

Add headers to all requests

  • Use the same system as defaultParams and add them in request.dispatch and request.dispatchSecure
  • Generate and automatically add X-7d-traceid for all requests from the same API instance.

Streaming issue?

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' }

Enable /catalogue/log endpoint support

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

Honour the response caching headers

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.

Request JSON from API by default where supported by the endpoint

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.

  • Specify the requested content-type the schema file and enable it on a case-by-case basis
  • Parsed JSON may not have the same schema as the parsed XML; if so we need to document differences and provide a mechanism to override the schema and revert to parsed XML.

Remove cache

Caching would be better done with something like varnish now that the cache headers are all correct and sensible on the API.

Remove special case for basket when parsing

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.

Null response causes error

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.

Update lodash dependency.

The version of Lodash currently used has two security vulnerabilities (1 low, 1 moderate). Upgrading should be a non-breaking change.

Oauth helper does not support country codes

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.

Change to use jessie and fix up the unloved integration tests

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.

Double checking OAuth.getAccessToken()

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!

Restructure and improve tests

May need to be split into several issues:

  • Change all examples to use environment variables and automate testing them all.
  • Standardise assertions on chai's assert.
  • Rename to test folder.
  • Add tests for failure conditions on oauth tokens
  • Add test for oauth sign helper

Support 3rd party user management

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.

Best way to change country code globally?

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!

2-legged signing is broken

When refactoring the sign helper to allow 3-legged signing, I inadvertently made the parameters argument required.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.