Created
October 1, 2021 11:05
-
-
Save subudear/e8d730b28c175838f424a8cb5cab3923 to your computer and use it in GitHub Desktop.
collection to send events to azure event hub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "0b02fd94-70ce-4cb2-a0b6-1fb45cadbf17", | |
"name": "Send Event to EventHub", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "Get Access Token for sending Event", | |
"event": [ | |
{ | |
"listen": "test", | |
"script": { | |
"exec": [ | |
"var data = JSON.parse(responseBody);\r", | |
"postman.setEnvironmentVariable(\"access_token\", data.access_token);" | |
], | |
"type": "text/javascript" | |
} | |
} | |
], | |
"protocolProfileBehavior": { | |
"disableBodyPruning": true | |
}, | |
"request": { | |
"method": "GET", | |
"header": [ | |
{ | |
"key": "Content-Type", | |
"value": "application/x-www-form-urlencoded", | |
"type": "text" | |
} | |
], | |
"body": { | |
"mode": "urlencoded", | |
"urlencoded": [ | |
{ | |
"key": "grant_type", | |
"value": "{{grant_type}}", | |
"type": "text" | |
}, | |
{ | |
"key": "client_id", | |
"value": "{{client_id}}", | |
"type": "text" | |
}, | |
{ | |
"key": "client_secret", | |
"value": "{{client_secret}}", | |
"type": "text" | |
}, | |
{ | |
"key": "resource", | |
"value": "{{resource}}", | |
"type": "text" | |
} | |
] | |
}, | |
"url": { | |
"raw": "https://login.microsoftonline.com/{{tenantid}}/oauth2/token", | |
"protocol": "https", | |
"host": [ | |
"login", | |
"microsoftonline", | |
"com" | |
], | |
"path": [ | |
"{{tenantid}}", | |
"oauth2", | |
"token" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Send Event", | |
"request": { | |
"auth": { | |
"type": "bearer", | |
"bearer": [ | |
{ | |
"key": "token", | |
"value": "{{access_token}}", | |
"type": "string" | |
} | |
] | |
}, | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "{ “Location”: “California”, \"Temperature\":\"46.0\" } ", | |
"options": { | |
"raw": { | |
"language": "json" | |
} | |
} | |
}, | |
"url": { | |
"raw": "https://{{servicebusNamespace}}.servicebus.windows.net/{{eventHubPath}}/messages", | |
"protocol": "https", | |
"host": [ | |
"{{servicebusNamespace}}", | |
"servicebus", | |
"windows", | |
"net" | |
], | |
"path": [ | |
"{{eventHubPath}}", | |
"messages" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Send Event with Publisher ID", | |
"request": { | |
"auth": { | |
"type": "bearer", | |
"bearer": [ | |
{ | |
"key": "token", | |
"value": "{{access_token}}", | |
"type": "string" | |
} | |
] | |
}, | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "This is test message", | |
"options": { | |
"raw": { | |
"language": "xml" | |
} | |
} | |
}, | |
"url": { | |
"raw": "https://{{servicebusNamespace}}.servicebus.windows.net/{{eventHubPath}}//publishers/{{publisherId}}/messages", | |
"protocol": "https", | |
"host": [ | |
"{{servicebusNamespace}}", | |
"servicebus", | |
"windows", | |
"net" | |
], | |
"path": [ | |
"{{eventHubPath}}", | |
"", | |
"publishers", | |
"{{publisherId}}", | |
"messages" | |
] | |
} | |
}, | |
"response": [] | |
}, | |
{ | |
"name": "Send Partition Event", | |
"request": { | |
"auth": { | |
"type": "bearer", | |
"bearer": [ | |
{ | |
"key": "token", | |
"value": "{{access_token}}", | |
"type": "string" | |
} | |
] | |
}, | |
"method": "POST", | |
"header": [], | |
"body": { | |
"mode": "raw", | |
"raw": "This is partition 0", | |
"options": { | |
"raw": { | |
"language": "xml" | |
} | |
} | |
}, | |
"url": { | |
"raw": "https://{{servicebusNamespace}}.servicebus.windows.net/{{eventHubPath}}/partitions/{{partitionId}}/messages", | |
"protocol": "https", | |
"host": [ | |
"{{servicebusNamespace}}", | |
"servicebus", | |
"windows", | |
"net" | |
], | |
"path": [ | |
"{{eventHubPath}}", | |
"partitions", | |
"{{partitionId}}", | |
"messages" | |
] | |
} | |
}, | |
"response": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment