Forum Discussion
Connecting an API to Power BI
Hello Everyone,
I'm having the hardest time connecting a to PowerBI via API with a key. I'm not sure where to start I have zero experience with API.
While connecting the API I get an error for "A web API key can only be specified when a web API key name is provided" or AN API key value wasn't specified"
8 Replies
- TaylorN
Helper I
Hi dgarcia
Do you know how the API expects authentication to be passed? You should (hopefully) find this in the API documentation. It looks like you've tried to add some HTTP headers there, and that makes sense because many APIs expect a token/key to be provided as a header (i.e. X-API-Key etc.).
If it does indeed expect an API key via HTTP header, then you should be able to simply choose "Anonymous" authentication, and ensure that you specify the API key in the HTTP header value.
- TaylorN
Helper I
That would mean that the data being returned isn't a webpage as you've specified (i.e. HTML tags etc.) Can you try using something like Postman to hit that API endpoint to see the data that you're getting back?
Postman is pretty easy to use, and in my opinion, crucial when working with APIs. Just create a new GET request, type in that URL, click the "headers" tab, and add your API key, just as you've done in Power BI.
- dgarciaRegular VisitorHi TaylorN ,
If it' helpful I provided the instructions that I'm supposed to use to create the API from the community OS system.
Search API Documentation
Authentication
Authentication is HTTP header-based, using the Authorization-Token header with the calling account's API key.
API keys can be generated here.
Compression
The deflate compression algorithm is supported. Send the "Accept-Encoding" header with the value "deflate" to enable.
REST Methods
Valid REST Methods: GET and POST
Limit
The "limit" parameter via GET or POST is supported in all REST methods. This parameter will restrict the number of rows returned by the API. This parameter must be greater than zero and less than or equal to 200. If no limit is provided the API will default to 200.
Offset
The "offset" parameter via GET or POST is supported in all REST methods. The offset will present the results offset by the integer provided. Using this parameter you can paginate the results from this api. Therefore a request may access any page (n) from this api by supplying an offset of n * limit + 1.
Order
The "order" parameter via GET or POST is supported in all REST methods. The order will present the results ordered by the given column or json array of columns.
JSON Format
All responses and posted values should be valid JSON within a key/value structure. Valid keys and data types on this API deployment:
{
"Client_CreateStamp": {
"value": "timestamp with time zone",
"operator": [
"date_greaterthan | date_lessthan | date_equals | greaterthan | lessthan | equals | minus_days_interval | minus_months_interval | minus_years_interval | plus_days_interval | plus_months_interval | plus_years_interval"
]
},
"Interaction_CreateStamp": {
"value": "timestamp with time zone",
"operator": [
"date_greaterthan | date_lessthan | date_equals | greaterthan | lessthan | equals | minus_days_interval | minus_months_interval | minus_years_interval | plus_days_interval | plus_months_interval | plus_years_interval"
]
},
"AssistanceSystem_AssistanceDate": {
"value": "timestamp with timezone (ISO, mdy)",
"operator": [
"equals | lessthan | greaterthan"
]
}
}
Example GET call:
curl \
"https://icfs.communityos.org/api/WoolseyFire" \
-X GET \
-H 'Authorization-Token: account_api_key'
Example POST call:
curl \
"https://icfs.communityos.org/api/WoolseyFire" \
-X POST \
-H "Content-Type: application/json" \
--data '{ \
"Client_CreateStamp": { \
"value": "timestamp with time zone", \
"operator": [ \
"date_greaterthan | date_lessthan | date_equals | greaterthan | lessthan | equals | minus_days_interval | minus_months_interval | minus_years_interval | plus_days_interval | plus_months_interval | plus_years_interval" \
] \
}, \
"Interaction_CreateStamp": { \
"value": "timestamp with time zone", \
"operator": [ \
"date_greaterthan | date_lessthan | date_equals | greaterthan | lessthan | equals | minus_days_interval | minus_months_interval | minus_years_interval | plus_days_interval | plus_months_interval | plus_years_interval" \
] \
}, \
"AssistanceSystem_AssistanceDate": { \
"value": "timestamp with timezone (ISO, mdy)", \
"operator": [ \
"equals | lessthan | greaterthan" \
] \
} \
}' \
-H 'Authorization-Token: account_api_key'
Example Result Object:
{
"result": "success",
"data": [
{
"Client_CreateStamp": "timestamp with timezone",
"Client_Id": "text",
"Client_CreateAccountId": "create account id",
"Client_CreateAccountId_HrefLabel": "account name and id",
"Client_CreatePortalId": "create portal id",
"Client_CreateFormsetDeploymentId": "create formset deployment id",
"Client_EditAccountId": "edit account id",
"Client_EditAccountId_HrefLabel": "account name and id",
"Client_EditPortalId": "edit portal id",
"Client_EditFormsetDeploymentId": "edit formset deployment id",
"Client_EditStamp": "timestamp with timezone",
"Client_AuditStamp": "timestamp with timezone",
"Client_Status": "status of record (active | deleted | archive)",
"ClientEvent_ClientEvent": "text",
"ClientUpload_PriorContactOrganizations": "text",
"ClientAccount_DcmAssignment": "text",
"ClientOption_PredisasterLivingSituationBestDescribedAs": "text",
"ClientOption_DcmpPriorityLevel": "text",
"ClientOption_PreferredLanguageOptionId": "text",
"ClientOrganization_CaseManagerOrganization": "text",
"ClientCustom_Veteran": "text",
"ClientAddressus_ClientAddressus": "text",
"ClientSystem_FirstName": "text",
"ClientSystem_LastName": "text",
"ClientSystem_DateOfBirth": "text",
"ClientSystem_SingleHeadOfHouseholdWithMinorsInHome": "text",
"ClientSystem_RecoveringFromPreviousDisaster": "text",
"ClientSystem_MemberWfunctionalAndAccessNeeds": "text",
"ClientSystem_LivingInUnsafeunsanitaryEnvironment": "text",
"ClientSystem_SufferedDamageAndIsUnderinsured": "text",
"ClientSystem_TotalNumberOfChildrenUnder18": "text",
"ClientSystem_TotalNumberOfAdults18OrOlder": "text",
"ClientSystem_IsolatedGeographicallySocially": "text",
"ClientSystem_HouseholdSignificantEmotionalDistress": "text",
"ClientSystem_HouseholdIncludesMembersAged65OrOlder": "text",
"ClientSystem_HouseholdWithMentalHealthNeeds": "text",
"ClientSystem_HouseholdWithMedicallyRelatedNeeds": "text",
"Interaction_CreateStamp": "timestamp with timezone",
"Interaction_ClientId": "text",
"Interaction_Id": "text",
"Interaction_CreateAccountId": "create account id",
"Interaction_CreateAccountId_HrefLabel": "account name and id",
"Interaction_CreatePortalId": "create portal id",
"Interaction_CreateFormsetDeploymentId": "create formset deployment id",
"Interaction_EditAccountId": "edit account id",
"Interaction_EditAccountId_HrefLabel": "account name and id",
"Interaction_EditPortalId": "edit portal id",
"Interaction_EditFormsetDeploymentId": "edit formset deployment id",
"Interaction_EditStamp": "timestamp with timezone",
"Interaction_AuditStamp": "timestamp with timezone",
"Interaction_Status": "status of record (active | deleted | archive)",
"Assistance_ClientId": "text",
"Assistance_Id": "text",
"Assistance_CreateAccountId": "create account id",
"Assistance_CreateAccountId_HrefLabel": "account name and id",
"Assistance_CreatePortalId": "create portal id",
"Assistance_CreateFormsetDeploymentId": "create formset deployment id",
"Assistance_EditAccountId": "edit account id",
"Assistance_EditAccountId_HrefLabel": "account name and id",
"Assistance_EditPortalId": "edit portal id",
"Assistance_EditFormsetDeploymentId": "edit formset deployment id",
"Assistance_CreateStamp": "timestamp with timezone",
"Assistance_EditStamp": "timestamp with timezone",
"Assistance_AuditStamp": "timestamp with timezone",
"Assistance_Status": "status of record (active | deleted | archive)",
"AssistanceOption_Organization": "text",
"AssistanceCustom_Notes": "text",
"AssistanceSystem_AssistanceDate": "text",
"AssistanceSystem_Value": "text"
}
]
}