Skip to main content

Notifications

Copilot Studio - General
Unanswered

HTTP Request status code not returned

(0) ShareShare
ReportReport
Posted on by 6

I have a topic in AI Copilot Studio that uses HTTP Request. IT is calling a simple service, is_timecode, that takes a single parameter string and returns a true or false boolean. Everything is working well except the status code. I have set the status code within the HTTP request to a variable, status_code, but it doesn't seem to be set except when there is an error code. I would like to validate the status code is set to 200 and then process the boolean value in the result. When I read through the documentation Perform HTTP requests - Microsoft Copilot Studio | Microsoft Learn it implies this status code is only returned for errors. I find that a very odd design.

Can you advise if I'm misunderstanding how the status code is meant to be used for HTTP Request? My sample YAML below. Also, my web service returns the status code in the following python code: 

    return jsonify(result), 200  # Return the JSONified response
kind: AdaptiveDialog
beginDialog:
  kind: OnRecognizedIntent
  id: main
  intent:
    triggerQueries:
      - Is {Timecode} a timecode?
      - I wonder if {Timecode} is a timecode.
      - "{Timecode} is it a timecode?"

  actions:
    - kind: SetVariable
      id: setVariable_Ir3szb
      variable: Topic.timecode_val
      value: 00:01:01:01

    - kind: HttpRequestAction
      id: NjzNn8
      method: Post
      headers:
        Content-Type: application/json

      body:
        kind: JsonRequestContent
        content: "={timecode: Topic.timecode_val}"

      errorHandling:
        kind: ContinueOnErrorBehavior
        statusCode: Topic.status_code
        errorResponseBody: Topic.status_response

      requestTimeoutInMilliseconds: 30000
      response: Topic.is_timecode
      responseSchema: Boolean
      responseHeaders: Topic.response_headers

    - kind: SendActivity
      id: sendActivity_v4VHN4
      activity: "{Topic.status_code}"

    - kind: SendActivity
      id: sendActivity_3GXuts
      activity: testing

    - kind: SendActivity
      id: sendActivity_reBrOd
      activity: "{Topic.is_timecode}"

    - kind: ConditionGroup
      id: conditionGroup_IBQejZ
      conditions:
        - id: conditionItem_yfhf0a
          condition: =Topic.status_code = 200
          actions:
            - kind: ConditionGroup
              id: conditionGroup_6wmHt9
              conditions:
                - id: conditionItem_cPZ866
                  condition: =Topic.is_timecode = true
                  actions:
                    - kind: SendActivity
                      id: sendActivity_Uf2gdD
                      activity: It is a timecode

              elseActions:
                - kind: SendActivity
                  id: sendActivity_LdAVhc
                  activity: It is not a timecode.

      elseActions:
        - kind: SendActivity
          id: sendActivity_bVzjdj
          activity: An error occurred.

    - kind: EndDialog
      id: fuQb7i

outputType:
  properties:
    is_timecode:
      displayName: is_timecode
      type: Boolean
Categories:
  • FL-11100204-0 Profile Picture
    FL-11100204-0 2 on at
    HTTP Request status code not returned
    What I found is that StatusCode is only set when there is an error with the http request.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard