cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Stevel
Advocate III
Advocate III

APIM custom connector - no content response

Hi,

I'm building a custom connector between PowerApps and Azure API management. We can call the API endpoint from CURL, Postman and SwaggerHub getting a valid response.

 

When we export the swagger 2.0 json file from APIM and import it into our custom connector it appears OK (after we add the required 200 and 405 responses to the json file). We then proceed to authorize the API in the connection (adding the API key) and test the connection at which time we get  an empty response body.

 

When I run the test in the PowerApps Connector Test tab I see (bold added):

Request:

URL:

https://msmanaged-na.azure-apim.net/apim/zpatient-xxxxxxxxxxxxxxxxxxxxxxxx/24

 

Method: Get

Headers:

{

  "Authorization": "Bearer eyJ0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

}

 

Response

Status

(200)

Headers

{

  "content-length": "0",

  "date": "Fri, 21 Feb 2020 15:25:58 GMT",

  "request-context": "appId=cid-v1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

}

Body (blank)

 

Schema validation:

Property "" type mismatch, Expected: "object", Actual: "string".

 

Any ideas why we are unable to get a proper response from our APIM call using PowerApps?

 

Thanks!
....Steve

 

In Postman, CURL and swaggerhub I get this response (for example):

{
"resourceType": "Patient",
"id": "24",
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:xxxxxxxxxxxxxxxxxxxxxxxxx",
"code": "2106-3",
"display": "White"
},
{
"system": "urn:oid:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"code": "2028-9",
"display": "Asian"
},
{
"system": "urn:oid:xxxxxxxxxxxxxxxxxxxxxxxxx",
"code": "2076-8",
"display": "Native Hawaiian or Other Pacific Islander"
}
]
}
},
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:xxxxxxxxxxxxxxxxxxxx",
"code": "2186-5",
"display": "Not Hispanic or Latino"
}
]
}
}
],
"name": [
{
"text": "BBBBBBB AAAAAA",
"family": "AAAAAA",
"given": [
"BBBBBBBB"
]
},
{
"use": "old",
"text": "BBBBBB,XXXXXXXX"
}
],
"gender": "male",
"birthDate": "2009-xx-xx",
"deceasedBoolean": false,
"address": [
{
"use": "home",
"line": [
"123 Test Ave"
],
"city": "Test",
"state": "MA",
"postalCode": "02130"
}
],
"photo": [
{
"id": "24",
"url": "PatientImage/24"
}
]
}

 

17 REPLIES 17

Add this to your APIM inbound policy. You can do the same using a policy configuration, form-based editor.

 

        <cors>
            <allowed-origins>
                <origin>https://flow.microsoft.com</origin>
            </allowed-origins>
            <allowed-methods>
                <method>*</method>
            </allowed-methods>
            <allowed-headers>
                <header>*</header>
            </allowed-headers>
            <expose-headers>
                <header>*</header>
            </expose-headers>
        </cors>
Anonymous
Not applicable

Hello,

I found that adding * and limiting what has access works well. Taking the default to allow anyone to come in is fine. The reason is because you are already secure via subscription key or other authorization methodologies and policies. When you go to the method you can add the default CORs policy.

Hi, 

 

Could it be that I have to adjust some settings within powerapps platform?

 

varsha_dhawale
Microsoft
Microsoft

Hi wanted to update the Key used to access the API was not correct which was configured in Azure Function. So passed that key as parameter to API and bingoo... could connect the API and recived the desired response. So we also need to check the Key that is configured to access the API

Anonymous
Not applicable

 This actually didn't work. I am still receiving the errors.

sidhem
Frequent Visitor

Hei @Anonymous , Were you able to resolve this ? We ran into same the same issue in our environment.

 

Any help here is appreciated. 

Thanks!

kbsicdp
New Member

I am getting same issue, even after allowing cors for any domain

Getting same issue, even after setting cors

 

<cors>
            <allowed-origins>
                <origin>*</origin>
            </allowed-origins>
            <allowed-methods>
                <method>GET</method>
                <method>POST</method>
            </allowed-methods>
        </cors>

 

 

Hi there @aroy2020 , Can you be kind enough to provide some more information on this. Where do I go to set the cors policy exactly? thanks in advance

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,640)