1

i am new to using hyperlink based api, to accessing the api and it links i am using traverson.js and traverson-hal.js in my client side application. the problem is when ever i make a call and pass the link to be follow in follow() it gives error msg Error: Links must be objects, not string: here is my sample code

traverson.registerMediaType(TraversonJsonHalAdapter.mediaType,TraversonJsonHalAdapter);

    var api = traverson.from(rootUrl);
    api.jsonHal().withRequestOptions
    ({ 
        headers: { 
            'accept': 'application/hal+json',
            'Authorization':'Bearer my-access-token'
        }
    })
    .follow(['_links'])
    .getResource(function(err, resource) {

    })
Ashish Patel
  • 921
  • 1
  • 10
  • 26

0 Answers0