16
submitted 1 year ago by Yoru@lemmy.world to c/lemmyworld@lemmy.world

https://lemmy.ml/api/v3 works for lemmy.ml, but when I try it with lemmy.world it gives bad request, any help?

you are viewing a single comment's thread
view the rest of the comments
[-] simple@lemmy.world 6 points 1 year ago

Works on my end when you go for an existing request page like https://lemmy.world/api/v3/post/list

[-] Yoru@lemmy.world 2 points 1 year ago

hmm, interesting. It works when I do it in my node environment, but the moment the browser tries to make the request it fails.

[-] damn@lemmy.fmhy.ml 5 points 1 year ago

The error message tells you why it failed

[-] Yoru@lemmy.world 1 points 1 year ago

oh, it's because lemmy.world doesn't allow api requests from lemmy.ml, and vice-versa. Is it possible that there's a workaround?

[-] ericjmorey@lemmy.world 1 points 1 year ago

Make a bot account on the other server

[-] Yoru@lemmy.world 1 points 1 year ago

I'm making a bookmarklet to transfer followed communities from one instance to another

[-] ericjmorey@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

Whoever would be using that bookmarklet would need to have accounts on both instances.

[-] Yoru@lemmy.ml 1 points 1 year ago

that's not the issue unfortunately, websites usually don't allow api requests to be made from another website, I fixed it using this github repo

[-] nickel@lemmy.world 4 points 1 year ago* (last edited 1 year ago)

@Yoru@lemmy.ml - it has to do with CORS (says in the error message) - You generally can't make cross-origin requests in the browser unless it is explicitly allowed. This is purely a browser limitation, which is why it works in your node environment. But if you open the console on any random website and try to call fetch() to that API, it's going to fail on any site other than lemmy.world.

[-] Yoru@lemmy.world 0 points 1 year ago

yeah that's what I observed after a few more trying, is there a possible workaround to this?

[-] nickel@lemmy.world 2 points 1 year ago

Anything you do cross-origin will have to be done in a server-like environment instead of in the browser.

[-] miked@lemmy.world 1 points 1 year ago

Works for me on Firefox

this post was submitted on 13 Jun 2023
16 points (100.0% liked)

Lemmy.World Announcements

29048 readers
2 users here now

This Community is intended for posts about the Lemmy.world server by the admins.

Follow us for server news ๐Ÿ˜

Outages ๐Ÿ”ฅ

https://status.lemmy.world

For support with issues at Lemmy.world, go to the Lemmy.world Support community.

Support e-mail

Any support requests are best sent to info@lemmy.world e-mail.

Report contact

Donations ๐Ÿ’—

If you would like to make a donation to support the cost of running this platform, please do so at the following donation URLs.

If you can, please use / switch to Ko-Fi, it has the lowest fees for us

Ko-Fi (Donate)

Bunq (Donate)

Open Collective backers and sponsors

Patreon

Join the team

founded 1 year ago
MODERATORS