/api/conversations stop working sine 5/9
No conversationId return after HTTP Post
Seeing similar. Used to return a 200, now returns a 201, but the DirectLine SDK expects 200 response and therefore is failing the request.
Workaround until they either update the SDK or revert back to returning a 200.
try
{
return await this.directLineClient.Conversations.NewConversationAsync();
}
catch (HttpOperationException ex)
{
if (ex.Response.StatusCode == HttpStatusCode.Created)
{
var conversationJson = await ex.Response.Content.ReadAsStringAsync();
var conversation = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject<Bot.Conversation>(conversationJson);
return conversation;
}
throw;
}
I just started having the same problem
Each conversation on the Direct Line channel must be explicitly started using a POST to the https://directline.botframework.com/api/conversations endpoint. If the call was authorized with a token, the conversation ID is the conversation ID in the scoped token. If a secret was used to start the conversation, the conversation will be started with a new, random ID.
The client may send messages to the bot by calling POST on https://directline.botframework.com/api/messages/conversationId.
Are you referring to NewConversationAsync returning 201 instead of returning 200?
I got 201.
ok. so what changed from last week. Last week same code was working and was returning 200. Now, it got broken because it is returning 201. Does this mean, DirectLine Api was changed but the nuget library hasnt updated yet?
We just pushed out a new release of Direct Line but this broke older clients so I've changed it to return 200 in all cases. Existing clients should work with it for now. If we change its behavior in the future, we'll upgrade the Nuget package before changing the service.
@dandriscoll This type of change should be treated as a breaking change and versioned appropriately. Take the BotConnector API as an example it has a versioned interface. You guys should consider adopting a similar design practice for the DirectLine API.
Saying you'll update the Nuget package in the future will not solve this type of problem since people that have a dependency on the old Nuget package would still be negatively impacted.
Sure, good suggestion. Thanks
@dandriscoll To be fair there have been breaking changes introduced that do not conform to standard semantic versioning which Nuget adheres to. On the flip side I also understand that the bot framework is technically still in "preview" mode and that you guys are still finalizing the APIs.
I have also been bit in the recent past when I updated the Nuget packages which appears to only introduce minor version changes but actually included breaking API changes.
@wbreza I see you posted a workaround where do I put that code?
@whatsdis I don't know if that workaround is still required since they had rolled back the change with regard to the status code. If that workaround is still required you would add it wherever you are calling into the direct line client. If you're not using direct line client then this may be a different issue.