Rest API - Translated Forms - CORS issue | Community
Skip to main content
Level 2
May 10, 2022
Solved

Rest API - Translated Forms - CORS issue

  • May 10, 2022
  • 1 reply
  • 4225 views

I am trying to update the translated forms we have running that use this methodology: https://nation.marketo.com/t5/product-discussions/marketo-form-localization-translations/m-p/53988#M23260

 

I updated the submission endpoint, base url, etc to use the REST API information, but I am getting a CORS error.   I am also wondering if I need to reformat the information.  I was able to successfully submit in Postman, but when I added the code to this page: https://sovos.com/it/libreria-dei-contenuti/iva/post-brexit-iva-norme-e-book-proteggere-transfrontaliero-commercio/ I end up with the CORS error in addition to some CSS issues.   

 

I am not sure how to resolve the CORS error, as I am using the URLs provided which are all new and substantially different from both the LP URL and the direct marketo ##--app.marketo.com URL as well. 

Best answer by SanfordWhiteman

The REST API is never to be used directly on web pages. The error is expected.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
May 10, 2022

The REST API is never to be used directly on web pages. The error is expected.

shenhuidarren
Level 1
May 11, 2022

How it should be use?

SanfordWhiteman
Level 10
May 11, 2022

How it should be use?

The Marketo REST API (like most such APIs) is for server-to-server or app-to-server communication. Not browser-to-server.

 

And even if you gateway requests from the browser through a back end that in turn communicates with Marketo, you must pay very close attention to per-IP rate limits. Otherwise, you’re letting anonymous people consume your API calls just by interacting with the page.