web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Copilot Studio - Copilot Studio pre-built Agent...
Suggested answer

Does anyone know how to properly reference variables in the request body?

(0) ShareShare
ReportReport
Posted on by
- kind: HttpRequestAction
              id: 3Q1x1c
              latencyMessageSettings:
                allowLatencyMessage: true
 
              method: Post
              url: https://api.anthropic.com/v1/messages
              headers:
                anthropic-version: 2023-06-01
                Content-Type: application/json
                x-api-key: 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
 
              body:
                kind: JsonRequestContent
                content:
                  kind: ValueExpression
                  literalValue:
                    max_tokens: 1024
                    messages:
                      - content: hi
                        role: user
 
                    model: claude-sonnet-4-20250514
 
              errorHandling:
                onError:
                  kind: SetVariable
                  value: Claude API 오류
                  variable: Topic.Error
 
              response: Global.ClaudeResponse
 
            - kind: HttpRequestAction
              id: ExtractContent
              method: Post
              url: https://jwd4d9-3001.csb.app/extract-claude-content
              headers:
                Accept: application/json
                Content-Type: application/json
                User-Agent: Your-App/1.0
 
              body:
                kind: JsonRequestContent
                content:
                  kind: ValueExpression
                  literalValue:
                    claudeResponse: ${Global.ClaudeResponse}
 
              requestTimeoutInMilliseconds: 30000
              response: Topic.CleanContent
              responseSchema: String
 
 
 
 
 
"I'm trying to pass the Claude API response into the request body of a second HTTP call, but it keeps going in as a literal string instead of the actual variable value. Does anyone know how to properly reference variables in the request body?"
 
I have the same question (0)
  • Suggested answer
    chiaraalina Profile Picture
    227 on at
    Does anyone know how to properly reference variables in the request body?
    Hi
     
    Have you tried with expression instead of literalValue?
     
    body:
      kind: JsonRequestContent
      content:
        kind: ValueExpression
        expression: >
          {
            "claudeResponse": Global.ClaudeResponse
          }

     
    This uses Power Fx syntax inside the expression, which does evaluate Global.ClaudeResponse at runtime and builds a proper JSON payload.

    Let me know if it works!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 420 Super User 2025 Season 2

#2
trice602 Profile Picture

trice602 141 Super User 2025 Season 2

#3
Jerry-IN Profile Picture

Jerry-IN 68

Last 30 days Overall leaderboard