mrsB2013
mrsB2013

Reputation: 211

Unable to send POST request to DialogFlow (404)

I am working on upgrading a 3 year old api.ai app to DialogFlow. I have modified the request using the Migration Guide. I get a 404 error using the base url: https://dialogflow.googleapis.com/v2/{session=projects/Project_ID/agent/sessions/1}:detectIntent

This is from the detectIntent documentation. I am trying to use the detectIntent method, but I was having the same problem when I tried to use context. Additionally, I have tried on multiple networks. I even get a 404 when I put it in a browser. Any idea what is incorrect in my URL?

Upvotes: 4

Views: 1779

Answers (1)

Prisoner
Prisoner

Reputation: 50701

As noted at the documentation for detectIntent, the URL uses Google API HTTP notation to document parameters and how they need to be specified. That second link isn't very useful, but basically it means that you can interpret the URL

https://dialogflow.googleapis.com/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent

as

  • The parts outside the {} are literal. That is exactly what you should be sending in the URL.
  • The {} is not literal. It specifies a parameter.
  • The part inside the {} is a parameter named "session".
  • The "session" parameter takes the form of a string that has two portions that can be a single path segment (the description of detectIntent puts additional limitations on these portions, but sometimes this is specified in the notation) and the rest is a literal path.

So if the session is projects/12345/agent/sessions/6789 then the URL will be

https://dialogflow.googleapis.com/v2beta1/projects/12345/agent/sessions/6789:detectIntent

Upvotes: 7

Related Questions