Plugin

Developer
Supported

SimplEE Instagram

ExpressionEngine 2, ExpressionEngine 3

Back to this add-on's main page
View Other Add-ons From SimplEE

     

You must be logged in to post.

Instagram 400 BAD REQUEST

Bug Report

Est Digital
Est Digital

Hi, i can’t get the module to work. i want to show a picture feed from instagram, ive made the client_id but i get this PHP error on the page (the client_id has been replaced with *):

A PHP Error was encountered

Severity: Warning

Message: file_get_contents(https://api.instagram.com/v1/tags/cats/media/recent?count=10&client;_id=****): failed to open stream: HTTP request failed! HTTP/1.1 400 BAD REQUEST

Filename: simplee_instagram/pi.simplee_instagram.php

Line Number: 179

Any idea whats wrong?

Jamie Blacker
# 1
Jamie Blacker

This seems to be down to Instagram changing the API to require an access token. I’m not sure when this was introduced, but this page https://www.instagram.com/developer/endpoints/ states:
The Instagram API requires an access_token from authenticated users for each endpoint. We no longer support making requests using just the client_id.

So it’d be great to get a proper fix for this from someone who understands the IG API and this plugin a bit better, but as a short term fix, the following works for me (albeit with a few php notices).

First you need to get your access token. Follow the instructions here: http://jelled.com/instagram/access-token

Then you need to modify this plugin a bit.

simplee_instagram/config.php
Add this:
define(“INSTAGRAM_ACCESS_TOKEN”, “XXXX-YOUR-TOKEN”);

pi.simplee_instagram.php
Add to line 22:
$this->access_token = INSTAGRAM_ACCESS_TOKEN;

Add to line 133:
$get[‘access_token’] = $this->access_token;


That will then append the access token to the API call and should work.

octopusink
# 2
octopusink

Sorry to hijack this thread. I tried Jamie’s workaround method, but can’t seem to get it to work. It shows the error:

Message: file_get_contents(https://api.instagram.com/v1/users/search?q=[username]&count=1&client;_id=[client_id]&access;_token=[access_token]): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request

[square brackets indicate edited credentials]

and also

“Could not find a user with username”

Am I missing something?

Jamie Blacker
# 3
Jamie Blacker

Is it possible that instagram just isn’t finding anything with the query? I’ve only tried my workaround with this tag (it’s a live site, so i don’t want to play much!):

{exp:simplee_instagram:user user_id="USER_ID" limit="20"}
<a href="{link}" target="_blank"><img src="{thumbnail}" alt="{caption}" width="150" height="150" /></a>
{/exp:simplee_instagram:user} 

Maybe try that and see if that works - if so, then it might mean that my workaround is very specific! Sorry!

octopusink
# 4
octopusink

Hi Jamie, sorry for the late reply, finally got down to testing it.

And it works!

My problem the first time round was due to authorisation error: In http://jelled.com/instagram/access-token, for step 3, you actually need to be logged in to the instagram account that you’re pulling data from. Hence, for client work, you’ll need to get them to run the steps and give you the access token.

I also had to use userid=”“, instead of username

nevsie
# 5
nevsie

This change is effectively what i worked out myself the hard way! it does work.
However, certain features such as multiple images, and videos still play up.

NiaBrowns1
# 6
NiaBrowns1

Framework as Code administration is acquiring following each day as they offer particular advantages for organizations. DevOps IaC administrations allude to a specific way to deal with IT framework management.It guarantees that DevOps strategies are liberated from blunders and can be redeployed on various workers. It implies that DevOps framework as code works the same way as applications for general delivery. So rather than physically setting a worker, an expert can run a layout script that sets numerous workers in the ideal arrangement automatically.IaC DevOps permits treating foundation the same way some other code will be dealt with. There is consistency in variant control, observing, testing, and virtualization. With this methodology, one DevOps expert can begin even 100 machines with only one press button.CI/CD DevOps rehearses are essential for a comprehensive and lithe way to deal with programming improvement in general.DevOps alludes to the large number of practices, ideas, and cycles that make programming advancement quicker and more powerful. The center of this methodology is automation.So how does IaC identify with this? IaC is an idea that alludes to the accepted procedures of framework the board (counting workers, putting away, and overseeing networks).IaC is one of the vital acts of the DevOps framework. iac, ci/cd, devops and devsecops all work together and carry out similar principles to guarantee a predictable and useful advancement process.Infrastructure straightforwardly impacts the delivery cycle. And IaC rehearses help to set segments of it amazingly quick, which expands advancement speed.As the name proposes, this device is generally utilized for organizations working with the Amazon cloud. AWS DevOps foundation as code instrument is a coordinated help that guarantees the executives by means of JSON or YAML. There are a few superb computerization highlights to send assets over and over. When the format is done, CloudFormation will do everything naturally. It is handy, simple to set, and secure.Azure Resource Manager is another cloud-stage specific answer for Microsoft programming. ARM formats permit handling arrangement in one cycle. It utilizes JSON language and the revelatory technique. It is feasible to pronounce a few assets in a single format, which is an or more. And formats are reusable an endless number of times.Google Cloud Deployment Manager is utilized by framework as code application code DevOps group that work with Google cloud. The arrangement documents use YAML, and formats are finished with JINJA2 or PYTHON. One of the masters is that different assets can be conveyed simultaneously. The audit highlight permits getting an outline prior to applying the content to the system.Terraform is a multi-cloud device that can work with any supplier. It can oversee immense and complex frameworks easily. The fundamental benefit is that it is substantially more versatile and adaptable than different frameworks. Yet, it’s anything but a con, as well – it is more perplexing in its center. There are such highlights as see, organization replication, far off state, and form control.Chefis one of the notable devices among CI/CD experts. It is Ruby-based and permits “cookbook” forming. So it is very helpful to handle quick foundation development and development.If you are keen on expanding your associations’ prosperity with framework as code DevOps group from Ukraine, you’ve gone to the opportune spot. Mobilunity is a specialist outstaffing accomplice that works with worldwide accomplices on a large number of IT projects.We have over a time of involvement with discovering ideal groups for different organizations. Here are only a portion of our fulfilled clients – esurance (Switzerland), Zenchef (France), Opportunity Network (UK), Minedia (Japan), ICUC (Canada), and BYG-E(Denmark).Mobilunity can track down the best-devoted group for your business and do it quick. We join western administration with eastern ability.

Aric Joshua
# 7
Aric Joshua

So it’d be great to have a good fix for this from someone who knows a bit more about the IG API and this plugin. This update stick merge is essentially what I’ve carefully found out on my own! It’s effective. Certain capabilities, such as numerous photos and movies, do, nevertheless, continue to work.