App Flow with POST JSON API Action does not send JSON Data value

Wappler Version : 5.8.2
Channel: Stable
Operating System : Windows 11
Server Model: Capacitor
Database Type: N/A
Hosting Type: N/A

Expected behavior

I expect to not have any errors in my API call and to be able to see the JSON data in Network tab.

Content-Length is showing as 0, with no reference to the JSON data.

Actual behavior

I getting an error from my API call complaining that the JSON is empty.

How to reproduce

Create an API action in an App Flow that uses JSON Data Type and then add data into the JSON Data field.

Bumping for support.

Bump

Can you tell me what the generated code on the page looks like.

The base64url code in the JSON data field or the entire page that API action is in?

This is the App Flow. It makes it all the way to the messagesSend api action, which I have currently hardcoded with a value in the JSON data field, but for some reason the Flow is not grabbing the data in it when it executes the API Action.

If it is an app flow it should have generated a json file, you can right click on the flow and click open in code view to get the code.

The raw value is showing in the JSON Data field, but it doesn’t appear to be sent because the content-length is 0.

{
  meta: {
    $param: [
      {type: "text", name: "OauthId"},
      {type: "text", name: "userid"},
      {type: "text", name: "threadId"},
      {type: "text", name: "subject"},
      {type: "text", name: "fromName"},
      {type: "text", name: "fromEmail"},
      {type: "text", name: "cookie"},
      {type: "array", name: "toName"},
      {type: "array", name: "toEmail"},
      {type: "text", name: "importance"},
      {type: "array", name: "attachments"},
      {type: "text", name: "replyTo"},
      {type: "array", name: "cc"},
      {type: "array", name: "bcc"},
      {type: "text", name: "body"},
      {type: "text", name: "contentType"},
      {type: "boolean", name: "embedImages"}
    ]
  },
  exec: {
    steps: [
      {
        serverConnect: {
          url: "http://mysite.com/api/v1/auth/refresh_google",
          site: "mysite.com-v3",
          params: {userid: "{{$param.userid}}"},
          credentials: true,
          name: "refreshToken",
          outputType: "object"
        }
      },
      {
        condition: {
          if: "{{refreshToken}}",
          then: {
            steps: [
              {
                serverConnect: {
                  url: "http://mysite.com/api/v1/oauth",
                  site: "mysite.com-v3",
                  params: {provider: "Google", userid: "{{$param.userid}}"},
                  credentials: true,
                  name: "getOauthId",
                  outputType: "object"
                }
              },
              {
                condition: {
                  if: "{{getOauthId.data.userid.AccessToken}}",
                  then: {
                    steps: [
                      {
                        api.send: {
                          method: "POST",
                          url: "https://mysite.com/api/v1/mail",
                          data: {
                            fromName: "{{$param.fromName}}",
                            fromEmail: "{{$param.fromEmail}}",
                            replyTo: "{{$param.replyTo}}",
                            toName: "{{$param.toName}}",
                            toEmail: "{{$param.toEmail}}",
                            cc: "{{$param.cc}}",
                            bcc: "{{$param.bcc}}",
                            importance: "{{$param.importance}}",
                            subject: "{{$param.subject}}",
                            contentType: "{{$param.contentType}}",
                            body: "{{$param.body}}",
                            attachments: "{{$param.attachments}}",
                            embedImages: "{{$param.embedImages}}"
                          },
                          params: {
                            fromName: "{{$param.fromName}}",
                            fromEmail: "{{$param.fromEmail}}",
                            replyTo: "{{$param.replyTo}}",
                            toName: "{{$param.toName}}",
                            toEmail: "{{$param.toEmail}}",
                            cc: "{{$param.cc}}",
                            bcc: "{{$param.bcc}}",
                            importance: "{{$param.importance}}",
                            subject: "{{$param.subject}}",
                            contentType: "{{$param.contentType}}",
                            body: "{{$param.body}}",
                            attachments: "{{$param.attachments}}",
                            embedImages: "{{$param.embedImages}}"
                          },
                          schema: [
                            {
                              type: "object",
                              name: "data",
                              sub: [
                                {type: "boolean", name: "identity"},
                                {type: "text", name: "rfc822stream"}
                              ]
                            },
                            {
                              type: "object",
                              name: "headers",
                              sub: [
                                {type: "text", name: "access-control-allow-credentials"},
                                {type: "text", name: "content-encoding"},
                                {type: "text", name: "content-type"},
                                {type: "text", name: "date"},
                                {type: "text", name: "etag"},
                                {type: "text", name: "transfer-encoding"},
                                {type: "text", name: "vary"}
                              ]
                            }
                          ],
                          name: "rfc822Streamer",
                          output: true,
                          outputType: "object",
                          meta: [
                            {
                              type: "object",
                              name: "data",
                              sub: [
                                {type: "boolean", name: "identity"},
                                {type: "text", name: "rfc822stream"}
                              ]
                            },
                            {
                              type: "object",
                              name: "headers",
                              sub: [
                                {type: "text", name: "access-control-allow-credentials"},
                                {type: "text", name: "content-encoding"},
                                {type: "text", name: "content-type"},
                                {type: "text", name: "date"},
                                {type: "text", name: "etag"},
                                {type: "text", name: "transfer-encoding"},
                                {type: "text", name: "vary"}
                              ]
                            }
                          ]
                        }
                      },
                      {
                        condition: {
                          if: "{{rfc822Streamer.data.rfc822stream}}",
                          then: {
                            steps: [
                              {
                                comment: {msg: "Send message"}
                              },
                              {
                                api.send: {
                                  url: "https://gmail.googleapis.com/gmail/v1/users/me/messages/send",
                                  headers: {Authorization: "{{'Bearer '+getOauthId.data.userid.AccessToken}}"},
                                  schema: [
                                    {
                                      type: "object",
                                      name: "data",
                                      sub: [
                                        {type: "text", name: "id"},
                                        {type: "text", name: "historyId"},
                                        {
                                          type: "array",
                                          name: "messages",
                                          sub: [
                                            {type: "text", name: "id"},
                                            {type: "text", name: "threadId"},
                                            {
                                              type: "array",
                                              name: "labelIds",
                                              sub: [
                                                {type: "text", name: "$value"}
                                              ]
                                            },
                                            {type: "text", name: "snippet"},
                                            {
                                              type: "object",
                                              name: "payload",
                                              sub: [
                                                {type: "text", name: "partId"},
                                                {type: "text", name: "mimeType"},
                                                {type: "text", name: "filename"},
                                                {
                                                  type: "array",
                                                  name: "headers",
                                                  sub: [
                                                    {type: "text", name: "name"},
                                                    {type: "text", name: "value"}
                                                  ]
                                                },
                                                {
                                                  type: "object",
                                                  name: "body",
                                                  sub: [
                                                    {type: "number", name: "size"}
                                                  ]
                                                },
                                                {
                                                  type: "array",
                                                  name: "parts",
                                                  sub: [
                                                    {type: "text", name: "partId"},
                                                    {type: "text", name: "mimeType"},
                                                    {type: "text", name: "filename"},
                                                    {
                                                      type: "array",
                                                      name: "headers",
                                                      sub: [
                                                        {type: "text", name: "name"},
                                                        {type: "text", name: "value"}
                                                      ]
                                                    },
                                                    {
                                                      type: "object",
                                                      name: "body",
                                                      sub: [
                                                        {type: "number", name: "size"}
                                                      ]
                                                    },
                                                    {
                                                      type: "array",
                                                      name: "parts",
                                                      sub: [
                                                        {type: "text", name: "partId"},
                                                        {type: "text", name: "mimeType"},
                                                        {type: "text", name: "filename"},
                                                        {
                                                          type: "array",
                                                          name: "headers",
                                                          sub: [
                                                            {type: "text", name: "name"},
                                                            {type: "text", name: "value"}
                                                          ]
                                                        },
                                                        {
                                                          type: "object",
                                                          name: "body",
                                                          sub: [
                                                            {type: "number", name: "size"}
                                                          ]
                                                        },
                                                        {
                                                          type: "array",
                                                          name: "parts",
                                                          sub: [
                                                            {type: "text", name: "partId"},
                                                            {type: "text", name: "mimeType"},
                                                            {type: "text", name: "filename"},
                                                            {
                                                              type: "array",
                                                              name: "headers",
                                                              sub: [
                                                                {type: "text", name: "name"},
                                                                {type: "text", name: "value"}
                                                              ]
                                                            },
                                                            {
                                                              type: "object",
                                                              name: "body",
                                                              sub: [
                                                                {type: "number", name: "size"},
                                                                {type: "text", name: "data"}
                                                              ]
                                                            }
                                                          ]
                                                        }
                                                      ]
                                                    }
                                                  ]
                                                }
                                              ]
                                            },
                                            {type: "number", name: "sizeEstimate"},
                                            {type: "text", name: "historyId"},
                                            {type: "text", name: "internalDate"}
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      type: "object",
                                      name: "headers",
                                      sub: [
                                        {type: "text", name: "alt-svc"},
                                        {type: "text", name: "cache-control"},
                                        {type: "text", name: "content-encoding"},
                                        {type: "text", name: "content-length"},
                                        {type: "text", name: "content-type"},
                                        {type: "text", name: "date"},
                                        {type: "text", name: "server"},
                                        {type: "text", name: "vary"},
                                        {type: "text", name: "x-content-type-options"},
                                        {type: "text", name: "x-xss-protection"}
                                      ]
                                    }
                                  ],
                                  method: "POST",
                                  data: {
                                    raw: "Q29udGVudC1UeXBlOiBtdWx0aXBhcnQvYWx0ZXJuYXRpdmU7DQogYm91bmRhcnk9Ii0tX05tUC1mOTdhNGMyY2VmYTQ0NzIwLVBhcnRfMSINCkZyb206IEphbmUgRG9lIDxrZWl0aC5mYXdjZXR0MkBnbWFpbC5jb20-DQpUbzogaW5mb0Bzb2Z0bmlvLmNvbQ0KU3ViamVjdDogdGVzdA0KTWVzc2FnZS1JRDogPDk0ODJkMzQ0LWE5MTctMmQ2ZC0xYTdlLTJhZTgyM2U1NGQxY0BnbWFpbC5jb20-DQpYLVByaW9yaXR5OiAxIChIaWdoZXN0KQ0KWC1Nc21haWwtUHJpb3JpdHk6IEhpZ2gNCkltcG9ydGFuY2U6IEhpZ2gNCkRhdGU6IFRodSwgMjcgSnVsIDIwMjMgMTg6Mjk6MDcgKzAwMDANCk1JTUUtVmVyc2lvbjogMS4wDQoNCi0tLS1fTm1QLWY5N2E0YzJjZWZhNDQ3MjAtUGFydF8xDQpDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgNCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDdiaXQNCg0KdGVzdA0KLS0tLV9ObVAtZjk3YTRjMmNlZmE0NDcyMC1QYXJ0XzENCkNvbnRlbnQtVHlwZTogdGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04DQpDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA3Yml0DQoNCnRlc3QNCi0tLS1fTm1QLWY5N2E0YzJjZWZhNDQ3MjAtUGFydF8xLS0NCg"
                                  },
                                  dataType: "json",
                                  passErrors: false,
                                  name: "messagesSend",
                                  output: true,
                                  outputType: "object",
                                  meta: [
                                    {
                                      type: "object",
                                      name: "data",
                                      sub: [
                                        {type: "text", name: "id"},
                                        {type: "text", name: "historyId"},
                                        {
                                          type: "array",
                                          name: "messages",
                                          sub: [
                                            {type: "text", name: "id"},
                                            {type: "text", name: "threadId"},
                                            {
                                              type: "array",
                                              name: "labelIds",
                                              sub: [
                                                {type: "text", name: "$value"}
                                              ]
                                            },
                                            {type: "text", name: "snippet"},
                                            {
                                              type: "object",
                                              name: "payload",
                                              sub: [
                                                {type: "text", name: "partId"},
                                                {type: "text", name: "mimeType"},
                                                {type: "text", name: "filename"},
                                                {
                                                  type: "array",
                                                  name: "headers",
                                                  sub: [
                                                    {type: "text", name: "name"},
                                                    {type: "text", name: "value"}
                                                  ]
                                                },
                                                {
                                                  type: "object",
                                                  name: "body",
                                                  sub: [
                                                    {type: "number", name: "size"}
                                                  ]
                                                },
                                                {
                                                  type: "array",
                                                  name: "parts",
                                                  sub: [
                                                    {type: "text", name: "partId"},
                                                    {type: "text", name: "mimeType"},
                                                    {type: "text", name: "filename"},
                                                    {
                                                      type: "array",
                                                      name: "headers",
                                                      sub: [
                                                        {type: "text", name: "name"},
                                                        {type: "text", name: "value"}
                                                      ]
                                                    },
                                                    {
                                                      type: "object",
                                                      name: "body",
                                                      sub: [
                                                        {type: "number", name: "size"}
                                                      ]
                                                    },
                                                    {
                                                      type: "array",
                                                      name: "parts",
                                                      sub: [
                                                        {type: "text", name: "partId"},
                                                        {type: "text", name: "mimeType"},
                                                        {type: "text", name: "filename"},
                                                        {
                                                          type: "array",
                                                          name: "headers",
                                                          sub: [
                                                            {type: "text", name: "name"},
                                                            {type: "text", name: "value"}
                                                          ]
                                                        },
                                                        {
                                                          type: "object",
                                                          name: "body",
                                                          sub: [
                                                            {type: "number", name: "size"}
                                                          ]
                                                        },
                                                        {
                                                          type: "array",
                                                          name: "parts",
                                                          sub: [
                                                            {type: "text", name: "partId"},
                                                            {type: "text", name: "mimeType"},
                                                            {type: "text", name: "filename"},
                                                            {
                                                              type: "array",
                                                              name: "headers",
                                                              sub: [
                                                                {type: "text", name: "name"},
                                                                {type: "text", name: "value"}
                                                              ]
                                                            },
                                                            {
                                                              type: "object",
                                                              name: "body",
                                                              sub: [
                                                                {type: "number", name: "size"},
                                                                {type: "text", name: "data"}
                                                              ]
                                                            }
                                                          ]
                                                        }
                                                      ]
                                                    }
                                                  ]
                                                }
                                              ]
                                            },
                                            {type: "number", name: "sizeEstimate"},
                                            {type: "text", name: "historyId"},
                                            {type: "text", name: "internalDate"}
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      type: "object",
                                      name: "headers",
                                      sub: [
                                        {type: "text", name: "alt-svc"},
                                        {type: "text", name: "cache-control"},
                                        {type: "text", name: "content-encoding"},
                                        {type: "text", name: "content-length"},
                                        {type: "text", name: "content-type"},
                                        {type: "text", name: "date"},
                                        {type: "text", name: "server"},
                                        {type: "text", name: "vary"},
                                        {type: "text", name: "x-content-type-options"},
                                        {type: "text", name: "x-xss-protection"}
                                      ]
                                    }
                                  ]
                                }
                              }
                            ]
                          },
                          outputType: "boolean"
                        }
                      }
                    ]
                  },
                  outputType: "boolean"
                }
              }
            ]
          },
          outputType: "boolean"
        }
      }
    ]
  }
}

image

I found that there is indeed a problem with the implementation of json data. I’m updating it currently for the new App Connect Beta.

2 Likes

This has been fixed in the latest beta updates.