---
title: Access Pros&Cons  analytics 
layour: layout.html
---

# Access Pros&Cons  analytics

In order to access [Pros&Cons analytics](/overview/supported-content.html#pros-cons) via API:

- send an Http request to the Wonderflow API
- the body of the Http request shall be in JSON format
- the body of the Http request shall contain an object with two fields:

  - `query`: it is a string containing the GraphQL query or mutation
  - `variables`: it is a JSON object containing all the variables required by the field query

- the field variables shall contain the token for authenticating the request

## Example of request for Pros&Cons

An example of Http Request to access the Pros&Cons information follows:

```
Method: POST 
Url: graphql.wonderflow.co
Content-type: application/json
Body:

{
  query: "query query($token: String!, $productName: String!) {
    query(token: $token) {
      error
      user {
        products(where: { name: { _eq: $productName } }) {
          name
          qualitativeAnalysis(where: { channels: { _eq: "channel.io" } }) {
            prosConsData {
              annotation
              positive
              negative
              negativePercentage
              positivePercentage
              neutralPercentage
            }
          }
        }
      }
    }
  }",
  "variables": {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImlsaWFuYV9yb2RyaWd1ZXpAZ21haWwuY29tIiwiaWF0IjoxNTAwOTkwNzU4LCJleHAiOjE1MDE1OTU1NTh9",
    "productName": "product 1"
  }
}
```

**Example of response**

```json
{
  "data": {
    "query": {
      "error": "",
      "user": {
        "products": [
          {
            "name": "product 1",
            "qualitativeAnalysis": {
              "prosConsData": [
                {
                  "annotation": "protocol",
                  "positive": 0,
                  "negative": 0,
                  "negativePercentage": 0,
                  "positivePercentage": 0,
                  "neutralPercentage": 100
                },
                {
                  "annotation": "feed",
                  "positive": 1,
                  "negative": 0,
                  "negativePercentage": 0,
                  "positivePercentage": 100,
                  "neutralPercentage": 0
                },
                {
                  "annotation": "card",
                  "positive": 0,
                  "negative": 1,
                  "negativePercentage": 100,
                  "positivePercentage": 0,
                  "neutralPercentage": 0
                },
                {
                  "annotation": "matrix",
                  "positive": 0,
                  "negative": 0,
                  "negativePercentage": 0,
                  "positivePercentage": 0,
                  "neutralPercentage": 100
                },
                {
                  "annotation": "transmitter",
                  "positive": 0,
                  "negative": 1,
                  "negativePercentage": 100,
                  "positivePercentage": 0,
                  "neutralPercentage": 0
                },
                {
                  "annotation": "hard drive",
                  "positive": 0,
                  "negative": 1,
                  "negativePercentage": 100,
                  "positivePercentage": 0,
                  "neutralPercentage": 0
                }
              ]
            }
          }
        ]
      }
    }
  }
}
```

# Example using a client in Javascript

```javascript

let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImlsaWFuYV9yb2RyaWd1ZXpAZ21haWwuY29tIiwiaWF0IjoxNTAwOTkwNzU4LCJleHAiOjE1MDE1OTU1NTh9";
let productName = "product 1";

client.query({
  query: gql`
    query query($token: String!, $productName: String!) {
      query(token: $token) {
        error
        user {
          products(where: { name: { _eq: $productName } }) {
            name
            qualitativeAnalysis(where: { channels: { _eq: "channel.io" } }) {
              prosConsData {
                annotation
                positive
                negative
                negativePercentage
                positivePercentage
                neutralPercentage
              }
            }
          }
        }
      }
  }
      `,
  variables: {
    token,
    productName,
  },
})
```


