Posts by UBLThemes

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

Can anybody from Envato comment on when we’ll be able to use the API to retrieve the buyer’s purchases specific to an author without the user having to generate tokens or providing their api keys?

I’m looking to change a few things into my support platform so i’d like to know a possible ETA ?

Thank you.

Ive asked this a few times with no joy.

If the database was developed correctly then it should be simple to achieve yet they have not come with a solution yet.

Or if they have they have not announced it, maybe testing it?

I have noticed that since the API went offline for a few hours no-one has commented since.

Wondering if the API was abused?

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

I have a few more issue.

At the moment we have to create a few apps because we need to return to a few urls within the site, cant you allow more than 1 url to be input on the return urls as this is making us create multiple apps.

Either that or we have to make the person sign in every hour which is not the ideal solution.

Also at present the oauth can not verify purchases from the buyer with their own verification code.

For instance if the user is logged in and submits his own verification code, it returns false because the verification code is meant to be submitted via the author and this at present can not be achieved using the oauth version of this:

https://api.envato.com/v1/market/private/user/verify-purchase:verification-code-goes-here.json
683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

Hi I have found an issue or at least I can not find anything which resembles the problem.

If a user changes his/her name on Envato is a new purchased verification generated?

For instance my support site is 100% dependant on Envato’s API so it checks the username and checks if the user is within the database, if the name is not there it then creates a new user.

Now if a user has changed his/her/their name then it will create a new user account which can be a little bit of a pain for the person who is trying to look at his/her/their past tickets.

Is there a way of looking at their past usernames, and also state that this person has changed their name.

For instance on this:

https://api.envato.com:443/v1/market/private/user/account.json

It brings back the following:

{
  ["image"]=> "https://0.s3.envato.com/files/89625911/gravatar.png" 
  ["firstname"]=> "XXXXXX" 
  ["surname"]=> "XXXXXX" 
  ["available_earnings"]=>  "90999099.99" 
  ["total_deposits"]=> "0.00" 
  ["balance"]=>  "90999099.99" 
  ["country"]=> "Land Of Mars" 
  ["past_names"]=> "Land Of Mars" 
}

can you not have list of old names, and date of change?

Something like this:

{
  ["image"]=> "https://0.s3.envato.com/files/89625911/gravatar.png" 
  ["firstname"]=> "XXXXXX" 
  ["surname"]=> "XXXXXX" 
  ["available_earnings"]=>  "90999099.99" 
  ["total_deposits"]=> "0.00" 
  ["balance"]=>  "90999099.99" 
  ["country"]=> "Land Of Mars" 
  ["past_names"]=> [
  {
      ["username"]=> "OldUser" 
      ["changed_date"]=> "12-27-2013" 
  },
  {
      ["username"]=> "OldUser2" 
      ["changed_date"]=> "06-19-2014" 
  },
  ]
}

This way we check if the user is present and if it is not, then check its old username and check the database, then we can assign the new username to the old username which will stop complaining customers.

Else there are 2 issues, old verification tickets will fail, and it will make clients lose old tickets, forum posts.

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

Trying to get an image via the api but can’t get it too work, as it’s in a 3 layer part e.g.

previews > thumbnail_preview > small_url

My code is:
echo '<img src="',$json_data['matches'][$i]['small_url'],'" alt="',$json_data['matches'][$i]['name'],'" />';
but also tried:
echo '<img src="',$json_data['matches'][$i]['previews'][$i]['thumbnail_preview'][$i]['thumbnail_url'],'" alt="',$json_data['matches'][$i]['name'],'" />';

I am probably missing something simple, I am able to get the data out that’s in a first “layer” e.g. the ID, the Name etc just need to be able to get the image url.

Any pointers will be appreciated.

Hi I dont know without looking at the actual full code but you are using a comma instead of a full stop which will cause conflict anyway.

Dont know if that typo is just for this or if it was a copy and paste from the direct code.

For instant you have:

echo '<img src="',$json_data['matches'][$i]['small_url'],'" alt="',$json_data['matches'][$i]['name'],'" />';

Instead of:

echo '<img src=".$json_data['matches'][$i]['small_url'].'" alt="'.$json_data['matches'][$i]['name'].'" />';

have you tried just dumping the information to see where everything sits within the api.

For instance:

var_dump($json_data);
683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

Ok I found the issue with the sessions Envato are using.

Obviously this may not happen to others, but it will happen to some people.

Basically if you sign out of your account and sign into another account, the build.envato.com api login still thinks you are within your old account.

That is why it was only taking my main account.

Each time I logout of Envato I have to clear all my caches which is a little buggy and will confuse a lot of users if they have 2 accounts and trying to register on 1 click sites.

You can rectify this by simply checking if a session is already there and if it is, unset it as it looks like its not overriding the original sessions.

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

HI UBLThemes,

Thanks for posting that gist!

I’ve copied your code here: http://dtbaker.net/files/envato/test_api.php (view the code I used here: https://gist.github.com/dtbaker/8b7898780e2dfbb993fc )

It seems to work just fine, I can login to my main account and a test account, and both times they show the correct username at the end. Are you getting different results?

Thanks,
dtbaker

Even with on your site, I sign out of UBLThemes on account.envato.com, themeforest.net and on build.envato.com

I sign in using my other account and I only get the UBLThemes and not my second one.

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

HI UBLThemes,

Thanks for posting that gist!

I’ve copied your code here: http://dtbaker.net/files/envato/test_api.php (view the code I used here: https://gist.github.com/dtbaker/8b7898780e2dfbb993fc )

It seems to work just fine, I can login to my main account and a test account, and both times they show the correct username at the end. Are you getting different results?

Thanks,
dtbaker

Hi, yes I am getting only my UBLThemes account.

I have 2 accounts, one which ive just created just for this and this account.

All I get is this account.

I wonder why lol…

Tried logging out of themeforest.net and the build.envato.com and I still get the same results doing this.

Maybe its the way I setup the app.

What settings did you tick on your oauth application creation?

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

Thanks for the code example UBLThemes! That will help people. If you can paste more code (i.e. getting /market/private/user/username.json) I could try run the same code here and see how it goes.

Hi dtbaker

Here is the code simplified so I could show the code on here.

Its all in OOP which for some people is a little hard to read which is why I did it the good old procedural way rather than OOP.

Here is the code which asks for the initial code, then asks for the bearer and then finally asks for the username.

Obviously for those who dont know, you do not have to keep asking for the code and bearer, once its done you are set for 1 hour at least anyway!

As soon as I have finalised the coding I will submit the class so that there is not as much code everyone needs to look at :)

https://gist.github.com/anonymous/16182e852016755f91d5
683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says


Thank you salamagd for trying to help but I have tried this using a number of methods and I always come with the same result of it only accessing the authors applications username, email, avatar or country. I was signed out of my UBLThemes username and signed into a new username I created so I can test this.

No worries, I’m happy to help! I suspect you may have done something wrong with your implementation, or maybe not signed out of your UBLThemes username on account.envato.com – as plenty of people have been able to access the signed in user’s details using the above-mentioned endpoints. The private user endpoints will return details on the user currently signed in when the request is first made to https://api.envato.com/authorization – not the user that the app is registered under (or else there would be no point in having OAuth at all!)

Nevertheless, I agree that an endpoint to list an author’s sold items seems like it’d be a useful addition, I’ll add it to our list of feature requests!

My initial coding is as follows:

Sending the user to the authorization section by this link:

https://api.envato.com/authorization?response_type=code&client_id=the-api-name-goes-ere&redirect_uri=http://www.returnurlgoeshere.com

Then once the code is sent back i use the following:

if(isset($_GET['code'])){

    $clientid         = 'XXXX';
    $clientsecret     = 'XXXXXXXXXXX';
    $returnurl         = 'XXXXXXX';

    $initialurl = 'https://api.envato.com/token';

    $fields = array(
        'grant_type' => urlencode('authorization_code'),
        'code' => urlencode($_GET['code']),
        'client_id'     => urlencode($clientid),
        'client_secret' => urlencode($clientsecret)
    );

    //url-ify the data for the POST
    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    $fields_string = rtrim($fields_string, '&');

    $ch = curl_init($initialurl);

    //curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, count($fields));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_USERAGENT, $clientid);

    $cinit_data = curl_exec($ch);

    $initialdata = json_decode($cinit_data, true);

    curl_close($ch);

    if(empty($initialdata['access_token'])){ $errors[] = 'Could not get bearer, please contact admin'; }

Then its simply just getting the relevant information from the following:

https://api.envato.com:443/v1/market/private/user/username.json https://api.envato.com:443/v1/market/private/user/email.json https://api.envato.com:443/v1/market/user-badges:usernamegoeshere.json https://api.envato.com:443/v1/market/private/user/account.json

Now the only thing that comes back is my UBLThemes information.

I have tried logging out of both the envato marketplaces and developers api section so that it logs in as another user but it does not work.

Am I doing the initial wrong?

683 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes
says

Hi there, the new API already supports retrieving the signed-in user’s username, email address, country and thumbnail image via the /private/user/account, /private/user/username and /private/user/email endpoints, and it can do all of the above with “one-click registration” (ie. OAuth authentication with their Envato Account). The only thing currently not supported is getting the signed-in user’s purchases, something we hope to add very soon. If you’re having any difficulty implementing the above functionality, please let me know and I’ll do my best to help you.

Thank you salamagd for trying to help but I have tried this using a number of methods and I always come with the same result of it only accessing the authors applications username, email, avatar or country.

I was signed out of my UBLThemes username and signed into a new username I created so I can test this.

When registering using the Oauth it asks for acceptance of the application and when it returns from your website it then registers as UBLThemes.

I have tried doing this using the personal token but this does not help as its not a one click process as the user needs to input his/her username to do so, plus I could not get the email or country from it as that is within private data which needs oauth to access the information.

There should be a new section of api for authors only.

Something like:

https://api.envato.com:443/v1/market/private/authors/buyers-info.json

Which when accessing this from the users logged in it will bring up the following:

{
  "account": {
    "username": "UBLThemes",
    "image": "https://0.s3.envato.com/files/89625911/gravatar.png",
    "country": "United Kingdom",
    "country": "email@emaill.com" 
  },
  "products": [
    {
        "id": "110283",
        "purchased": "02-24-2014",
        "is_supported": "true",
        "support_end": "12-11-2015" 
    },
    {
        "id": "110283",
        "purchased": "02-24-2014",
        "is_supported": "true",
        "support_end": "12-11-2015" 
    },
    {
        "id": "110283",
        "purchased": "02-24-2014",
        "is_supported": "true",
        "support_end": "12-11-2015" 
    },
    {
        "id": "110283",
        "purchased": "02-24-2014",
        "is_supported": "true",
        "support_end": "12-11-2015" 
    },
    {
        "id": "110283",
        "purchased": "02-24-2014",
        "is_supported": "true",
        "support_end": "12-11-2015" 
    },
    {
        "id": "110283",
        "purchased": "02-24-2014",
        "is_supported": "true",
        "support_end": "12-11-2015" 
    }
  ]
}

this would stop so many requests having to be made which would make it less code and also less api requests.

In 1 request it gives the username, email, country, avatar, products and if these products are supported and when they are supported till.

That is all a author needs from this api system to get it to work with their support system.

Just my 2 cents though

by
by
by
by
by
by