Envato Api Response Problem

Hi everyone I try to using envato api for fetching some theme’s data. I used token and my php script is working at my localhost. I moved it to live site but it is not working, result (matching data) is coming as zero with all same parameters and same codes. I tried to generate new token, not working. After all I try to use online api tool, it is giving me same result with my live site. I don’t know what I must do, just a wait to work it again? My local script is working still.

Envato Api Result:

You are likely talking about two different issues here. To start, the build.envato.com website was designed a bit odd and requires you to explicitly click a link to log in before any of the demos will work. If you do not click this link, you will get the “no content” issue in your screenshot due to a JavaScript error. See this link for an example of what to click.

Now, onto your live server. You state that the result is coming back as zero – do you mean the request is successful but it has no matching items, or is the entire response blank? Have you printed out the entire raw response to check if the request is coming back properly?

I’m happy to help you sort this out but I will need more information:

  • What library are you using to connect to the API? (curl, request, urllib2, etc)
  • Have you checked the library for an error code to see if the request is failing?
  • What is the HTTP status code returned by the API? (200 is expected).
  • If the status code is 200, what is the raw body of the API response?
1 Like

Thanks for your reply sir, after click a link in your screenshot, try it out working now. I’m using curl library. On my live website this response coming from server:

{“took”:124,“matches”:,“item”:null,“timed_out”:false,“total_hits”:0,“links”:{“next_page_url”:null,“prev_page_url”:null,“first_page_url”:null,“last_page_url”:null},“author_exists”:false,“aggregations”:{“category_root_count”:{“key”:null,“count”:0,“description”:null},“category”:,“platform_root_count”:{“key”:null,“count”:0,“description”:null},“platform”:,"__internal_software_versions":,“file_formats”:null,“files_included”:null,“tags”:,“colors”:null,“rating”:[{“key”:"",“count”:0,“description”:null},{“key”:“1”,“count”:0,“description”:null},{“key”:“2”,“count”:0,“description”:null},{“key”:“3”,“count”:0,“description”:null},{“key”:“4”,“count”:0,“description”:null}],“date”:[{“key”:"",“count”:0,“description”:null},{“key”:“this-year”,“count”:0,“description”:null},{“key”:“this-month”,“count”:0,“description”:null},{“key”:“this-week”,“count”:0,“description”:null},{“key”:“this-day”,“count”:0,“description”:null}],“size”:null,“sizes”:null,“sales_count”:[{“key”:“rank-0”,“count”:0,“description”:null},{“key”:“rank-1”,“count”:0,“description”:null},{“key”:“rank-2”,“count”:0,“description”:null},{“key”:“rank-3”,“count”:0,“description”:null},{“key”:“rank-4”,“count”:0,“description”:null}],“cost”:{“count”:0,“min”:null,“max”:null,“avg”:null,“sum”:null},“length”:null,“tempo”:null,“alpha”:null,“looped”:null,“hosting_setup”:null,“resolution”:null,“vocals_in_audio”:null,“frame_rate”:null,“compatible_with”:,“orientation”:null,“requires_plugins”:null,“include_pro_affiliated”:null},“suggestions”:}

Ah okay, so it is connecting. I would first suggest that you echo out the URL your code is using to search for items, to make sure it is valid and has the correct search term in it.

1 Like

I think I’m so close to solution :slight_smile:

I’m using theme name to catch true theme. But I don’t know which format will be used for the ?term=$keyword.

If I use rawurlencode to format title
Buzznote – A Responsive WordPress Blog Theme
is becoming that:
Buzznote%20%26%238211%3B%20A%20Responsive%20WordPress%20Blog%20Theme

I’m using rawurlencode function to convert my string to url parameter format. Can you suggest me which format have to be used?

This is your problem. It decodes to:

Buzznote – A Responsive WordPress Blog Theme

Use html_entity_decode() on the item name before encoding it.

3 Likes

You’re awesome, thanks for all.

1 Like