Forum Discussion
Create a IoTHub Connection Using MS Fabric API
Hi,
I'm trying to create an IoTHub connection using the MS Fabric API.
Based on the sample in the documentation, I create my json body:
I'm not able to fin the parameter name expected for an IoTHub connection.
When I create this type of connection in MS Fabric, I assume it's waiting only 1 parameter.
I have tried multiple parameter name (iothub, azureiothub, name, ...) but I keep geting the same error:
Error response: {"requestId":"2b70a182-9448-439b-b732-f9338bb229a3","errorCode":"InvalidInput","moreDetails":[{"errorCode":"InvalidParameter","message":"Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path 'connection
Details.parameters[0]', line 18, position 79."}],"message":"The request has an invalid input"}
Here is my powershell object used to construct the body
Can you help me find this parameter name please?
Many thanks!
Regards,
Yohann
Hi,
I found an API endpoint in the documentaion to list the supported connection types.And with the "try it" option, you can retreive the needed information:
So the connections details for an IoTHub should have "IoTHub.Contents" as creation methods and "entutyPath" as parameter. Here is my body the is actually working. Which is akward because it's not matching exactly, I let you check the differences...
4 Replies
- yvaubourgResolver I
Hi,
I found an API endpoint in the documentaion to list the supported connection types.And with the "try it" option, you can retreive the needed information:
So the connections details for an IoTHub should have "IoTHub.Contents" as creation methods and "entutyPath" as parameter. Here is my body the is actually working. Which is akward because it's not matching exactly, I let you check the differences...
- burakkaragozSuper User
Hi yvaubourg ,
ran into the same issue when trying to create an IoTHub connection via API. The key thing is: the parameters array needs to contain objects, not plain strings.
Here’s a working example of the structure we used:
"connectionDetails": { "parameters": [ { "name": "connectionString", "value": "<your-iothub-connection-string>" } ] }Make sure:
- parameters is an array of objects
- Each object has a name and value
- For IoTHub, the expected parameter name is usually "connectionString"
Also double-check the content type and headers in your request – sometimes the API is picky about that too.
Let me know if you want a full sample PowerShell or REST call.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
- yvaubourgResolver I
Hi burakkaragoz,
Can you provide a full JSON sample of your body?
It's seem that I don't use the correct "creationMethod" value.
- burakkaragozSuper User
Hi yvaubourg ,
yeah, that part’s not super well documented tbh. there’s no single public list with all connection types + their expected parameter names (at least not yet).
what we do is:
- go to Fabric UI → create the connection manually
- open Dev Tools (F12) → Network tab
- watch the request payload when you hit “Create”
- you’ll see the exact structure + parameter names used by the UI
it’s a bit hacky but works every time.
also, some connection types are documented here (but not all):
https://learn.microsoft.com/en-us/fabric/data-factory/connector-overview