I think there is problem with header Token
modify it accordingly. I tried with curl by sending it in header. add this custom header
curl -X GET https://recruitment.elements.nl:8080/v1/carousel/ -H 'Authorization: Token 733129ed5566ed9b030872c6e003155a82da3c55'
This works for me.
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"image": "https://recruitment.elements.nl:8080/media/carousel/caroussel_1.png",
"image_2x": "https://recruitment.elements.nl:8080/media/carousel/caroussel_12x.png",
"title": "Little tittle",
"subtitle": "Big Title",
"action": "Button Action",
"action_url": "https://www.elements.nl/portfolio/mcdonalds-picto-campaign/"
},
{
"id": 2,
"image": "https://recruitment.elements.nl:8080/media/carousel/caroussel_2.png",
"image_2x": "https://recruitment.elements.nl:8080/media/carousel/caroussel_22x.png",
"title": "NU.nl responsive website",
"subtitle": "NEW WEBSITE",
"action": "GO!",
"action_url": "https://www.elements.nl/portfolio/nu-nl-responsive-website/"
},
{
"id": 3,
"image": "https://recruitment.elements.nl:8080/media/carousel/caroussel_3.png",
"image_2x": "https://recruitment.elements.nl:8080/media/carousel/caroussel_32x.png",
"title": "don't text and cycle",
"subtitle": "Fietsmodus app",
"action": "go to project",
"action_url": "https://www.elements.nl/portfolio/fietsmodus/"
}
]
}
$.ajax({
url: 'YourRestEndPoint',
headers: {
'Authorization':'Token xxxxxxxxxxxxx'
},
method: 'GET',
dataType: 'json',
data: YourData,
success: function(data){
console.log('succes: '+data);
}
});