Generic HTTP integration not working.

Are there any tricks to getting the generic http integration working? I’m trying to add a new data fetch to a page by clicking on new data query and choosing the generic http integration. I’m getting an “Internal Server Error” when trying to load the schema or previewing any endpoints. When I use Postman with the exact same settings I am able to successfully get json data. Any ideas would be most welcome!

Context: I’m querying the Swell commerce backend API. The end goal is to create a data fetch that can give me the carts/checkout_url value, so I can use Swell’s hosted checkout.

Hi @distinct_lizard , we aren’t generally equipped to help with specific apis that plasmic is being connected to, but I can take a best effort look with some limited knowledge of swell… Can you share screenshots showing what exactly is the error you are getting back and what is the query you are specifying within plasmic?

Appreciate the help! I configured authorization as Basic in the header on the page before this screenshot, which I assume is working because I’m getting a 500 error. I guess I’m expecting to be able to query the api from here and get json back, if I enter a valid endpoint like “carts” into the “Path” field. Does it work that way?

Yes that’s right

Using Chrome dev tools to monitor the request - when i hit the “Preview” button I see errant request get logged. Its actually making a POST request, not a GET, even though GET is selected in the dropdown and is the only option available.

I may be misunderstanding what’s going on, but shouldn’t a GET request be made when i hit the preview button?

That’s the request to our backends, which proxy the GET request over POST

Makes sense then. When I curl that swell api endpoint or do a get request from postman I get a 200. The only difference I can think of is here I’m using the backend API for these requests, which is a different path and uses the private key vs the frontend API which uses a public key. The swell plasmic integration uses the frontend API public key. Maybe swell doesnt like proxied backend API requests?

Can you share a screenshot of what query you’re doing in Plasmic?

(You shared an earlier screenshot but that’s wrong, that was without the cart path)

you can put any valid endpoint in there and hit preview and they all have the same error. /carts, /products, /categories, etc

as a comparison, from terminal on my local machine:

curl https://f|https://:@api.swell.store/carts

this gives me json data with a list of carts

I think that API url isn’t quite right? It’s querying api.swell.store

I also saw your other thread/question, that would actually be better since even if you get this to work, the Swell cart API expects to be run from the browser so that it can store session-specific cart info per unique browser

(The HTTP querying UI you see here runs from the Plasmic backend, whereas the HTTP Fetcher component runs from the user’s browser - it’s a bit confusing but we’ll be cleaning this up in the coming months, just trying to clarify for now)

api.swell.store is the backend API URL https://developers.swell.is/backend-api/introduction

Oh, I thought you were saying it’s https://<my-store-id>:<my-private-key>@api.swell.store/carts