Help for Envato Api

Hi,

I want to get response form the envato api using JS like this -

    $(document).ready(function() {
$.get(
	"https://api.envato.com/v1/market/total-items.json'",{
		key: 'MY_API_KEY'},
		function(data){
			$.each(data.DATA, function(DATA){
				console.log(DATA);
			})
		}
);

});

How can I do like this…

Can anyone give me a demo file?

Thank you…

Hello,
I think for v1 you need to send the authorization headers with the Bearer key.

Try this code. I hope this will work for you :smiley:

$.get({
    url: "https://api.envato.com/v1/market/total-items.json",
    headers: {"Authorization": "Bearer MY_BEARER_API_KEY"}
}).done(function (data) {
    console.log(data);
}).fail(function (jqXHR, textStatus) {
    alert("error: " + textStatus);
});

Really thank you for working for me… But Bro I need more help form you… The code didn’t work. I don’t know why. If you help me more, I will be very pleased.

Here is the exact thing what I wanna do-

I want to track the sale of some of my items on envato through my browser (I just want to gather all data in a page). I am not a web developer. I don’t know code much. Can you please help me how I can access privet data by envato API?

Thank you what you have done for me.
Avagon

Hello Avagon,
Firstly you have to create the Bearer key from the envato API. Check for the step by step method. https://build.envato.com/api/#oauth

Finally with this step you’ll get the bearer key:

POST https://api.envato.com/token
     grant_type=refresh_token&
     refresh_token=[REFRESH_TOKEN]&
     client_id=[CLIENT_ID]&
     client_secret=[CLIENT_SECRET]

This bearer key will only valid for one hours. You can save your REFRESH_TOKEN for later use.
Every one hour later if you want to check then you will need to send a POST request again and then with the bearer key again send it to your envato api. Create an app for CLIENT_ID and CLIENT_SECRET. Save those infos also.

I am also trying to make an app for envato sale API. Hope it will be done soon. I can then send you the files. :slight_smile:

Thanks,
RedQ Team

i also want that file :stuck_out_tongue:

Check our script :slight_smile: