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
When trying Via postman I got this message.
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! Go to 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
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.
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
Im getting 200 from Google Doc
But still, postman is telling me the URL doesn't exist.
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
try https://dialogflow.googleapis.com/v2beta1/testbot-df/agent
That url is getting me the same result
I was doing with the parent=project/ due to this
try the URL I suggested with the region please
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.
Did you create the API from the project and add that to the api call ?
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
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |