Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Suggestions for Download tool with Google NLP?

Marina
5 - Atom

I've been trying to use download tool to process data through Google NLP (language processing) and retrieve a result back – unsuccessful.

 

Here's where I'm at.

 

OAuth macro (https://gallery.alteryx.com/#!app/OAuth-Login-Macro/58ef72dcf499c713d41edea3 ) seems to be working great and I'm getting Authorization back. Thanks to Christoph Wiese

 

This is config for the Download tool

 

URL: 'https://language.googleapis.com/v1/documents:analyzeEntities'

Headers:  Authorization from OAuth response

Payload: one string as 'REPLACE 6S ACCU#2, ZS-925920 BAD FAN MOTOR & BLADE, REPLACE WITH NEW ONES. Current Meter Reading Cooling Fan could not take away heat from the condensers. Cooling fan motor bearings bad and winding, the fan blades was broken completely.'

 

ERRORS

Download headers

HTTP/1.1 400 Bad Request

Vary: Origin

Vary: X-Origin

Vary: Referer

Content-Type: application/json; charset=UTF-8

Content-Encoding: gzip

Date: Tue, 23 May 2017 14:49:00 GMT

Server: ESF

Cache-Control: private

X-XSS-Protection: 1; mode=block

X-Frame-Options: SAMEORIGIN

X-Content-Type-Options: nosniff

Alt-Svc: quic=":443"; ma=2592000; v="37,36,35"

Transfer-Encoding: chunked

 

Download Data

{

  "error": {

    "code": 400,

    "message": "Invalid JSON payload received. Unknown name \"document\": Cannot bind query parameter. 'document' is a message type. Parameters can only be bound to primitive types.",

    "status": "INVALID_ARGUMENT",

    "details": [

      {

        "@type": "type.googleapis.com/google.rpc.BadRequest",

        "fieldViolations": [

          {

            "description": "Invalid JSON payload received. Unknown name \"document\": Cannot bind query parameter. 'document' is a message type. Parameters can only be bound to primitive types."

          }

        ]

      }

    ]

  }

}

 

1 REPLY 1
MikeSp
Alteryx
Alteryx

Hello @Marina,

 

I know we spoke about this through support channels, but I did want to provide the solution here as well for other users that may run into this problem in the future.

 

The issue was that Google NLP requires data to be in a specific JSON format as listed here - https://cloud.google.com/natural-language/docs/analyzing-entities

 

Our payload was updated to the following. (We used a formula tool for this example, but it would be possible to use the JSON Build lab tool as well.)

 

{"document":{"type":"PLAIN_TEXT","content":"REPLACE 6S ACCU#2, ZS-925920 BAD FAN MOTOR & BLADE, REPLACE WITH NEW ONES. Current Meter Reading Cooling Fan could not take away heat from the condensers. Cooling fan motor bearings bad and winding, the fan blades was broken completely."}}

We also added the header value "Content-Type" as "application/json" within the download tool to make sure the download tool was passing the data to Google in the correct JSON format. We then received the expected output from Google.

 

-Mike

Mike Spoula
Senior Solutions Architect
Alteryx
Labels
Top Solution Authors