{ 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
    • Adapter for Envoy
    • 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 /
  • Apigee Test - archive /
avatar image
2

Apigee Test (f.k.a. API Health) : Overview of script module in probe request  

  • Export to PDF
Hari Prakash created · Jul 20, 2015 at 12:33 PM · 923 Views · Dino edited · Feb 22, 2016 at 05:39 PM

Script module allows you to set a Javascript variables in the probe request and the same can be used in other request fields like URI, HTTP method, Request body & headers.

Variables which are set in the first probe step can be used in the following steps.

How to add script variables

(refer number pointers in the above image)

  1. When adding a new probe
  2. Editing an existing probe

Usage of script variables

(refer number pointers in the above image)

  1. Script field can be found in Advanced section
  2. You can add your script in the provided textarea, make sure you add a valid Javascript and it passes JSLINT
  3. Currently system supports only btoa and crypto npm modules. In case, if we support any other npm modules, it will be notified in this section
  4. Script field accepts only 5000 characters, watch out the counter while you copy & paste the script
  5. Script variables which are declared can be used in request URI, Header & body. Also it can be used in the forth coming probe steps

Example:

Declare variables:

var keyString = 'name' + ':' + '123';

var encodedValue = btoa(keyString);

Usage in request URI:

http://testorama-test.apigee.net/httpbin?name=${script.encodedValue}

1.jpg (80.0 kB)
2.jpg (129.7 kB)
thub.nodes.view.add-new-comment
apisapigee testscript variables
Add comment Show 4
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 alan@apigee.com ♦ · Feb 22, 2016 at 07:46 PM 3
Link

This is really cool. I was on a webinar with AWS, and I asked them what they thought about Apigee Test.

His reply is that combining Apigee Test, mobile apm, Apigee Edge's analytics, and AWS Cloudwatch makes a killer combo for devops.

avatar image kiquetal_edge · Mar 18, 2016 at 09:41 PM 0
Link

What is the recommended way to request a token before call an api?

avatar image Hari Prakash ♦ kiquetal_edge · Mar 19, 2016 at 02:30 AM 0
Link

You can make the request token call in the first step and then store the token in the extract variable.

In the second step you can use the extracted variable to call an API.

In case if you aren't aware how to use extract variables, below article guide you

https://community.apigee.com/articles/7934/extract-variables-in-api-monitoring-apihealth.html

avatar image Siddhesh · Mar 31, 2017 at 12:02 PM 0
Link

How to get extract variable in script code?

I have written below code:

var consumerid=${ConsumerID};

var region=consumerid.substring(0,3);

where ${ConsumerID} is extracted in previous step of test case.
But I am getting error "Script execution in the request flow failed with the following error : ReferenceError:***consumeridvalue(contentHiddhenForsecurity)*** is not defined"

Article

Contributors

avatar image avatar image avatar image

Follow this article

9 People are following this .

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

Navigation

Apigee Test (f.k.a. API Health) : Overview of script module in probe request

Related Articles

Using test cases to create probes

Apigee Test (earlier called API Health) - A Monitoring tool for your APIs

New UI and Conceptual Changes in Apigee Test

APIs to interact with Apigee Test

Apigee Test (earlier called API Health) Probe responses are limited to 1MB

Apigee Test (earlier called API Health) Outage on 2nd July

Apigee Test (earlier called API Health) documentation

PagerDuty support in apigee Test

Maintenance Update scheduled for Apigee Test

New geography added - Tokyo

  • 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
© 2021 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
  • Adapter for Envoy
  • 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
  • Badges