Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add studio (view/modify) API #28

Open
2 of 4 tasks
towerofnix opened this issue Jul 21, 2018 · 6 comments
Open
2 of 4 tasks

Add studio (view/modify) API #28

towerofnix opened this issue Jul 21, 2018 · 6 comments
Labels

Comments

@towerofnix
Copy link
Owner

towerofnix commented Jul 21, 2018

See scratchfoundation/scratch-www#1985. This is probably a big one!

  • (GET) /projects/<id>/studios
  • (GET) /users/<username>/studios/curate
  • (POST) /studios/<id>/project/<id> (add to studio; requires auth)
  • (DELETE) /studios/<id>/project/<id> (remove from studio; requires auth)
@towerofnix towerofnix added the api label Jul 21, 2018
@joker314
Copy link
Contributor

By the way, it's not <id> for some of these, but instead <username>.

My theory was that endpoints that are sent an authentication token will return extra data for the Scratch Team. I find this not as likely anymore, though -- so it might be that the implementation in the linked issue is wrong. (Or a bug in the API!). Either way, devs might want to know.

@towerofnix
Copy link
Owner Author

My guess is that you need authentication to join a studio, but not to view your (or anyone's) studio list. So either the PR writer (@benjiwheeler, pinging you) or internal documentation for scratch-api made a mistake and thought authentication was needed either way.

Anyways, it makes sense that you can view a list of which studios a user is curating without being authenticated; that's one of the rows on any profile page ("Studios I Curate").

@joker314
Copy link
Contributor

There exists a risk that ST employees are instructed not to interact with repositories of others (especially of kids), it might be a good idea to track this in the pull request rather than here -- especially since all the ST devs will be watching?

@towerofnix
Copy link
Owner Author

Oh, good point. I just didn't want to look like I was intruding on the discussion of a PR I'm unrelated to.

@towerofnix
Copy link
Owner Author

@joker314 Update - see scratchfoundation/scratch-www@a60da11 - indeed, that was just a mistake in the PR code. Getting the curated studios list doesn't require auth.

@towerofnix towerofnix added this to the Release of 3.0 Project Page milestone Oct 10, 2018
@towerofnix
Copy link
Owner Author

towerofnix commented Oct 10, 2018

Latter two endpoints won't work until preview page is out. Test code:

async function go() {
  const projectID = 248475643
  const studioID = 5542140

  const token = await fetch('/session', {headers: {'X-Requested-With': 'XMLHttpRequest'}}).then(res => res.json()).then(data => data.user.token)

  const res = await fetch(`https://api.scratch.mit.edu/studios/${studioID}/${projectID}?x-token=${token}`, {method: 'POST'})

  console.log(res)
}
go().catch(err => console.error(err))

@towerofnix towerofnix removed this from the Release of 3.0 Project Page milestone Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants