{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • API Design /
avatar image
0
Question by Madhav · Aug 09, 2017 at 11:44 AM · 299 Views api proxypoliciesapi designtarget serversassign message policytargetendpoint

how to change target server?

I have one proxy End point added Flow in request and In flow using JavaScript to construct Json Request Payload. No target serve/end point define.

like belw

var req = JSON.parse(request.content); var finalRequest = { Payer: req.payerID, UserName:UserNameVal}; request.content = ''; //To clear the request payload request.content = JSON.stringify(finalRequest);

now i want send that constructed request content to the new target server with Verb Post.

Plz help. thanks in advance

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

2 Answers

  • Sort: 
avatar image
0
Best Answer

Answer by Mahammad Feroz · Aug 09, 2017 at 02:07 PM

@Madhav , Looks like you are using the variable "myRequest" in SC policy which is not defined. Make the below changes in JS and SC policies and try again.

  1. JS snippet which you have added above is not correct. Use the below updated.
var req = JSON.parse(context.getVariable("request.content")); 
var finalRequest = { "Payer": req.payerID, "UserName":"UserNameVal"}; 
//To clear the request payload 
context.setVariable("request.content", JSON.stringify(finalRequest));

2. Change the request variable name "request" instead of "myRequest" in SC policy.

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Umanng Goel · Aug 09, 2017 at 12:15 PM

@Madhav

Hi,What I am able to understand from your requirement is that you want to send the entire request content to the target server with verb post.

As you mentioned that you haven't configured any target endpoint.So please use "Service Callout Policy" where u define your own back endpoint which you want to hit with the payload.

Comment
Add comment Show 2 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Madhav · Aug 09, 2017 at 12:56 PM 0
Link

I have added that getting error like below

{"fault":{"faultstring":"ServiceCallout[Service-Callout-1]: request variable myRequest value is not of type Message","detail":{"errorcode":"steps.servicecallout.RequestVariableNotMessageType"}}}
avatar image Umanng Goel Madhav · Aug 09, 2017 at 01:14 PM 0
Link
@Madhav

It seems you are not passing the correct request content.

Kindly go through the below url to set the request message

Servicecallout.

Also could you please provide the policy context if possible.

Follow this Question

Answers Answers and Comments

61 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it safe for the TargetEndpoint to call back into Apigee? 1 Answer

How to modify existing value in Json Payload body passing request. 3 Answers

How to PUT elements of collection into BaaS via Apigee proxy 1 Answer

Assign query parameter to request body 1 Answer

How can we create a single API proxy for GET, POST, PUT and DELETE but only grant access to specific method(s) to Client Apps 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges