Closed Bug 965964 Opened 9 years ago Closed 8 years ago

Expose 'installs_allowed_from' in API

Categories

(Marketplace Graveyard :: API, enhancement, P5)

Avenir
x86
macOS
enhancement

Tracking

(Not tracked)

VERIFIED FIXED
2014-12-02

People

(Reporter: robhudson, Assigned: robhudson)

Details

(Whiteboard: [repoman])

Suppose I'm a person who wants to set up a website with a custom list of apps. I pull my sources with carefully crafted search queries using the search API and display them on my page with an install button.

If the apps that come back do not have "*" as one of its items in the "installs_allowed_from" list, those apps would not be able to be installed from my awesome apps page.

I propose we store the "installs_allowed_from" list in the database and Elasticsearch and expose a filter in the API to only return apps that can be installed from any site.
I think I always assumed we'd have some cheesy iframe kind of hack for this, but when thinking about it, what you're suggesting does make sense.  An app shouldn't be available on another site if the developer doesn't allow it.  I'm a bit torn though - seems to make life more complicated for the app developer... I guess it depends how much we emphasize embedded/distributed app downloads (which sounds like it's one of our big plans).
Makes sense that third-party sites would not want to show search results that their users can't install. Do we want to allow this filtering on anything other than the main search API?
Severity: normal → enhancement
Priority: -- → P5
FYI: If "installs_allowed_frame" is omitted, it is implied to be "*"
Assignee: nobody → robhudson.mozbugs
Whiteboard: [repoman]
https://github.com/mozilla/zamboni/commit/bbff414
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2014-12-02
Can you please add some STRs to this bug or mark it as [qa-]?
(In reply to Madalin Cotetiu from comment #5)
> Can you please add some STRs to this bug or mark it as [qa-]?

Please verify:
* the search API properly filters out apps that have their `installs_allowed_from` set to a specific URL. See the search API docs:
http://firefox-marketplace-api.readthedocs.org/en/latest/topics/search.html#get--api-v2-apps-search-
* the search API will return a 400 if anything but '*' is supplied.
The search API is returning a 400 and {"detail":{"installs_allowed_from":["Select a valid choice. 12341234 is not one of the available choices."]}}  when performing a GET with an invalid parameter for install_allowed_from. Screenshot of the request using advanced rest console: http://screencast.com/t/JYSHWr7Z

When performing a request using installs_allowed_from=* it returns a 200 but the following json {"meta":{"next":null,"previous":null,"total_count":0,"offset":0,"limit":25},"objects":[]}
The request used by be was 
GET https://marketplace-dev.allizom.org/api/v2/fireplace/search?installs_allowed_from=*
Screenshot: http://screencast.com/t/YUyeMXrmYzXZ

So no apps are returned when using installs_allowed_from=*
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to Madalin Cotetiu from comment #7)
> The search API is returning a 400 and
> {"detail":{"installs_allowed_from":["Select a valid choice. 12341234 is not
> one of the available choices."]}}  when performing a GET with an invalid
> parameter for install_allowed_from. Screenshot of the request using advanced
> rest console: http://screencast.com/t/JYSHWr7Z

That looks good.

> When performing a request using installs_allowed_from=* it returns a 200 but
> the following json
> {"meta":{"next":null,"previous":null,"total_count":0,"offset":0,"limit":25},
> "objects":[]}
> The request used by be was 
> GET
> https://marketplace-dev.allizom.org/api/v2/fireplace/
> search?installs_allowed_from=*
> Screenshot: http://screencast.com/t/YUyeMXrmYzXZ
> 
> So no apps are returned when using installs_allowed_from=*

Sorry, I forgot to reindex on -dev to pick up the new field in the search index. This is done now.
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
(In reply to Rob Hudson [:robhudson] from comment #8)
> 
> > When performing a request using installs_allowed_from=* it returns a 200 but
> > the following json
> > {"meta":{"next":null,"previous":null,"total_count":0,"offset":0,"limit":25},
> > "objects":[]}
> > The request used by be was 
> > GET
> > https://marketplace-dev.allizom.org/api/v2/fireplace/
> > search?installs_allowed_from=*
> > Screenshot: http://screencast.com/t/YUyeMXrmYzXZ
> > 
> > So no apps are returned when using installs_allowed_from=*
> 
> Sorry, I forgot to reindex on -dev to pick up the new field in the search
> index. This is done now.

This part works too now, the apps are returned.

Also I have submitted an app with install_allowed_from field set to http://test.com and when performing a GET on https://marketplace-dev.allizom.org/api/v2/fireplace/search?installs_allowed_from=*&q=skunk1781 the app was not returned so the filtering part works too.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.