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

  • @YoruOP
    link
    32 years 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
      link
      fedilink
      62 years ago

      The error message tells you why it failed

      • @YoruOP
        link
        12 years 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
          link
          12 years ago

          Make a bot account on the other server

          • @YoruOP
            link
            12 years ago

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

            • @ericjmorey
              link
              1
              edit-2
              2 years ago

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

    • @nickel
      link
      English
      5
      edit-2
      2 years ago

      @[email protected] - 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.

      • @YoruOP
        link
        English
        22 years ago

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

        • @nickel
          link
          English
          32 years ago

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

    • Mike D.
      link
      12 years ago

      Works for me on Firefox