Giter VIP home page Giter VIP logo

gravitee-policy-callout-http's Introduction

HTTP Callout Policy

Build status Gitter

Phase

onRequest onResponse onRequestContent onResponseContent

X

X

-

-

Description

The callout HTTP policy can be used to invoke an HTTP(S) URL and put the content or a sub part of the content into one or more variables of request execution context.

This may be useful if you need some data from an external services and want to inject these data during request processing.

The result of the callout is put in a variable named calloutResponse and is only available during the policy execution. If no variable has been configured the result of the callout will not be available anymore.

Configuration

Property Required Description Type Default

method

X

HTTP Method used to invoke URL

HTTP method

GET

url

X

URL invoked by the HTTP client (support EL)

URL

-

headers

X

List of HTTP headers used to invoke the URL (support EL)

HTTP Headers

-

body

X

The body content send when calling the URL (support EL)

string

-

variables

X

The variables to set in the execution context when retrieving content of HTTP call (support EL)

List of variables

-

exitOnError

X

Terminate the request if the error condition is true

boolean

false

errorCondition

X

The condition which will be verified to end the request (support EL)

string

{#calloutResponse.status >= 400 and #calloutResponse.status โ‡ 599}

errorStatusCode

X

HTTP Status Code send to the consumer if the condition is true

int

500

errorContent

X

The body response of the error if the condition is true (support EL)

string

-

Sample
"policy-http-callout": {
    "method": "GET",
    "url": "https://api.gravitee.io/echo",
    "headers": [ {
        "name": "X-Gravitee-Request-Id",
        "value": "{#request.id}"
    }],
    "variables": [{
        "name": "my-server",
        "value": "{#jsonPath(#calloutResponse.content, '$.headers.X-Forwarded-Server')}"
    }]
}

Http Status Code

Code Message

500

An error occurs while doing HTTP call.

gravitee-policy-callout-http's People

Contributors

aelamrani avatar brasseld avatar graviteeio avatar tcompiegne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.