dialogflow / dialogflow-nodejs-client

Node.js SDK for Dialogflow
Apache License 2.0
659 stars 287 forks source link

V4.0.0 documentation vs. endpoint mismatch for /userEntities #40

Closed teddis closed 7 years ago

teddis commented 7 years ago

Looks like something's amuck with the official documentation for POST /v1/userEntities versus what POST /v1/userEntities is actually accepting, and I believe was previously documented as.

I've been posting to the /userEntities endpoint just fine using v3.0.3 for for quite sometime. "Upgrading" to v4.0.0 breaks this method. (This module should also include tests and much better and more complete documentation.) The author redefines the structure that's accepted to the documentation but returns as a bad request. Looks like some kind of botched endpoint version migration happening here.

Previously documented and currently accepted JSON by the /userEntries endpoint:

{
   "sessionId":"12345",
   "name":"city",
   "extend":false,
   "entries":[
      {
         "value":"New York",
         "synonyms":[
            "New York",
            "Big Apple"
         ]
      }
   ]
}

Newly documented and currently unaccepted JSON by the /userEntries endpoint see example:

{
    sessionId: sessionId,
    entities: [{
        name: 'Application',
        sessionId: sessionId,
        extend: false,
        entries: [
            {
                value: 'Firefox',
                synonyms: ['Firefox']
            },
            {
                value: 'XCode',
                synonyms: ['XCode']
            },
            {
                value: 'Sublime Text',
                synonyms: ['Sublime Text']
            }
        ]
    }]
};

Having to return to V3.0.3 until this is resolved. Thanks.