cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DougL
Level: Powered On

Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces" value

Everything I've been reading suggests that if the OpenAPI / Swagger file specifies a value for "prod...

 

However, I have the following OpenAPI file, which to me says I should be getting an "Accept" header on the request of "application/pdf":

{
  "swagger": "2.0",
  "info": {
    "title": "Accounting API",
    "version": "2.0"
  },
  "host": "MyWebSite",
  "basePath": "/api",
  "schemes": [
    "https"
  ],
  "paths": {
    "/Invoices/{InvoiceID}": {
      "get": {
        "summary": "getInvoice - Allows you to retrieve any sales invoices or purchase bills",
        "operationId": "getInvoice",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/pdf"
        ],
        "parameters": [
          {
            "required": true,
            "in": "path",
            "name": "InvoiceID",
            "type": "string",
            "format": "uuid"
          }
        ],
        "responses": {
          "200": {
            "description": "A successful request",
            "schema": {
              "$ref": "#/definitions/Invoice"
            }
          }
        },
        "security": [
          {
            "basicAuth": []
          }
        ]
      }
    }
  },
  "securityDefinitions": {
    "basicAuth": {
      "type": "basic"
    }
  },
  "definitions": {

. . . TRUNCATED . . .

When I dump all the headers in my Azure Function which is called by the Microsoft Flow there is not an "Accept" header set. As a result the web service does not return PDF content.

 

Does anybody know how to get Microsoft Flow to pass that information?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
DougL
Level: Powered On

Re: Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces"

This appears to be a bug. Based on everything I'm reading on how the OpenAPI specifications should be set the "produces" header should be set as the "Accept" header on any requests. Microsoft Flow does not do this.

 

As a work around you can specify a header parameter for "Accept" and then define that in my flow:

"parameters": [
{
"required": true,
"in": "header",
"name": "accept",
"type": "string"
}
]

 

As a result I have something working, but Microsoft should take a look at this and fix the behavior of Microsoft Flow to match the expected behavior.

2 REPLIES 2
Highlighted
DougL
Level: Powered On

Re: Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces"

This appears to be a bug. Based on everything I'm reading on how the OpenAPI specifications should be set the "produces" header should be set as the "Accept" header on any requests. Microsoft Flow does not do this.

 

As a work around you can specify a header parameter for "Accept" and then define that in my flow:

"parameters": [
{
"required": true,
"in": "header",
"name": "accept",
"type": "string"
}
]

 

As a result I have something working, but Microsoft should take a look at this and fix the behavior of Microsoft Flow to match the expected behavior.

Community Support Team
Community Support Team

Re: Microsoft Flow is not adding the Accept Header but OpenAPI specifies proper "produces"

Hi @DougL,

 

Thanks for the feedback.

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 212 members 4,479 guests
Please welcome our newest community members: