Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error: getaddrinfo ENOTFOUND dialogflow.googleapis.com

Hi @All
Right now I'm testing Dialogflow ES API V2 on Postman, I'm trying to query just the agent. In order to quick start.

When sending the request through Google site, I got the response

Mizar_0-1694489832829.png

When trying Via postman I got this message.

Mizar_1-1694489926931.png

I have already set up the OAuth 2.0 From Google Cloud side and Postman side.

Anyone has faced this issue?

Error: getaddrinfo ENOTFOUND dialogflow.googleapis.com

Solved Solved
1 15 4,842
1 ACCEPTED SOLUTION

this worked for me:

curl \
'https://dialogflow.googleapis.com/v2/projects/test-cx-346408/agent?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed

View solution in original post

15 REPLIES 15

Hi,

This is because you are missing the region. You have to contact the region at the beginning of the URL. For example:  us-central1-dialogflow.googleapis.com

hi @xavidop already tried with the region but look.

Mizar_1-1694610497484.png

https://cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1-overview#rest_endpoints

 

I'm using the default service endpoint

then Im using the resource

Mizar_2-1694610562699.png

Im getting 200 from Google Doc

Mizar_3-1694610634576.png

 

 

But still, postman is telling me the URL doesn't exist.

 

Mizar_4-1694610697052.png

p><b>404.</b> <ins>That’s an error.</ins>
    <p>The requested URL <code>/v2beta1/parent=projects/testbot-df/agent</code> was not found on this server.
        <ins>That’s all we know.</ins>

 

 

yeah so the main issue I am seeing is that the URL is not correct, you have to specify the project id: the format is projects/<Project ID> or projects/<Project ID>/locations/<Location ID>.

make sure that the token it is not expired as well

Im creating the token each time when Im testing, and its working so fine.

For the project id is testbot-df

this is my URL, what could be the error here?https://dialogflow.googleapis.com/v2beta1/parent=projects/testbot-df/agent

That url is getting me the same result

Mizar_1-1694624294701.png

I was doing with the parent=project/ due to this

Mizar_2-1694624361327.png

https://cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects/getAgent?apix_params=%7B...

try the URL I suggested with the region please

Mizar_0-1694642048699.png

Any suggestions? I have billing enabled for this account and the id is working fine, the error is just the url but its the documentation url

this worked for me:

curl \
'https://dialogflow.googleapis.com/v2/projects/test-cx-346408/agent?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed

Tried with the API key according to documentation but also, Documentation says that only OAUTH2.0 is the method to access.

Mizar_0-1694694798133.pngMizar_1-1694694860503.png

 

Did you create the API from the project and add that to the api call ?

Mizar_2-1694694910683.png

 

yes I did!

You can use API key & ouath token or just oauth token. Using only API token will not work

and this JS code:

 

<script src="https://apis.google.com/js/api.js"></script>
<script>
/**
* Sample JavaScript code for dialogflow.projects.getAgent
* See instructions for running APIs Explorer code samples locally:
* https://developers.google.com/explorer-help/code-samples#javascript
*/

function authenticate() {
return gapi.auth2.getAuthInstance()
.signIn({scope: "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/dialogflow"})
.then(function() { console.log("Sign-in successful"); },
function(err) { console.error("Error signing in", err); });
}
function loadClient() {
gapi.client.setApiKey("YOUR_API_KEY");
return gapi.client.load("https://dialogflow.googleapis.com/$discovery/rest?version=v2")
.then(function() { console.log("GAPI client loaded for API"); },
function(err) { console.error("Error loading GAPI client for API", err); });
}
// Make sure the client is loaded and sign-in is complete before calling this method.
function execute() {
return gapi.client.dialogflow.projects.getAgent({
"parent": "projects/test-cx-346408"
})
.then(function(response) {
// Handle the results here (response.result has the parsed body).
console.log("Response", response);
},
function(err) { console.error("Execute error", err); });
}
gapi.load("client:auth2", function() {
gapi.auth2.init({client_id: "YOUR_CLIENT_ID"});
});
</script>
<button onclick="authenticate().then(loadClient)">authorize and load</button>
<button onclick="execute()">execute</button>

Im testing it, but would like to achieve it from Postman, like sending a request before to prepare a collection to call all methods

let me know your progress!! happy to assist!

yes