I'm trying to tap the API - no dice | Community
Skip to main content
April 5, 2016
Question

I'm trying to tap the API - no dice

  • April 5, 2016
  • 1 reply
  • 2695 views

I'm trying to call the Marketo API and I'm getting this error: net::ERR_NAME_NOT_RESOLVED

this is the function I'm using

       var marketoAPIcallURL = '182-EMG-811.mktorest.com/rest/v1/';

        var apiToCall = 'lead/182.json';

        var accessToken = '?access_token=8a385a92-4a87-4e89-9eda-xxxxxxxxxxxx:ab';

        //

        console.log(marketoAPIcallURL);

        marketoAPIcallURL += apiToCall;

        console.log(marketoAPIcallURL);

        marketoAPIcallURL += accessToken;

        console.log(marketoAPIcallURL);

        //

      function callMarketoV3() {

            console.log('API CALL HAS BEGUN');

            console.log(marketoAPIcallURL);

            $.ajax({

                url: marketoAPIcallURL,

                type: "POST",

                contentType: "application/json; charset=utf-8",

                dataType: "json",

                success: function (data) {

                    console.log(data);

                }

            });

        }

Does anyone have an idea what the problem is?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
April 5, 2016
  1. That hostname does not exist.
  2. I hope you are not attempting to access the API via a browser.  You must not -- luckily, cannot -- do this.
April 5, 2016

that host name does not exist - i changed the first couple of numbers to 182.

why doesn't this work - could this work with node.js? If not - what method would I use to make this happen?

SanfordWhiteman
Level 10
April 5, 2016

that host name does not exist - i changed the first couple of numbers to 182.

You changed the hostname and wondered why it was giving ERR_NAME_NOT_RESOLVED?

why doesn't this work - could this work with node.js? If not - what method would I use to make this happen?

I have no idea what you're trying to accomplish. Please explain the project goals.

In any case, the REST API should be used for bulk operations, or singleton operations whose volume is strictly controlled by the back end that is using them. It must not be used for uncontrolled singleton operations, such as making API calls in response to individual user web actions.  Also, for technical reasons (same origin policy) you can't use the REST API via direct HTTP requests from a browser.