This is a sample JSON for one of the basket
Iirespective of basket name , in my case the secret attribute value is same. Is it not possible to include basket_id as the name of the basket ? Why is the basket name encrypted ? It would be easy for the user to manipulate the json rather than generating JSON for each basket name . The user would just put the actual basket name in nasket_id and directly call from trading view, since secret code is the same for all the baskets
As you rightly pointed out, secret parameter value will remain the same across all basket JSONs. This is because secret parameter is related to the Webhook URL and not the basket details.
basket_id is a system generated ID for each basket. This basket ID is unique in Dhan System and the webhooks place order on this parameter only. This is how the back-end system has been configured to avoid duplicacy and minimise probability of error.
Basket name itself is unique for the user. One cannot create duplicate basket name against his logged in user id… Since basket name is Unique for the user, is it not possible to pass the basket name (which is user friendly) to webhook , rather than create GUID for it ?
I agree that basket name is unique to user, but again basket name duplicacy check is of case-sensitive nature which means “Basket 1” and “basket 1” can exist as two different baskets for a user. This increases probability of human error. Besides that, on Dhan, you can also modify basket names. So, in a scenario where mapping is done on Basket name, everytime a user modifies basket name, we will also have to change the instruments mapped to the basket. Hence, from a system perspective, assigning unique ID to baskets for execution makes more sense.
Meanwhile, we are working to enhance order placement via Webhooks which will simplify direct orders on Webhook.
I got your point now… Based on your explanation I found an bug. Here are the repro steps
Create a basket named “Test1” with an strike price in it "
Try create another basket name “Test1”. You will get an message “Basket with same name already exists”
Now create a new Basket name “Test2” with an instrument in it
Now modify the basket name “Test2” with “Test1”
The basket name is modified to “Test1”
Now in the baskets you will find 2 entries with “Test1”
Now based on your explanation this is case sensitive and basket name is unique. If basket name is unique while creating new basket, the same test case fails while updation. You should not allow duplicate basket name while modification too… What criteria holds good during creation should hold good during modification too