https://github.com/abappm/abap-http-agent
Easy to Use HTTP Agent and Login Manager
https://github.com/abappm/abap-http-agent
abap agent apm html
Last synced: about 2 months ago
JSON representation
Easy to Use HTTP Agent and Login Manager
- Host: GitHub
- URL: https://github.com/abappm/abap-http-agent
- Owner: abapPM
- License: mit
- Created: 2024-12-05T09:38:43.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-30T18:28:31.000Z (3 months ago)
- Last Synced: 2025-03-09T09:47:38.776Z (about 2 months ago)
- Topics: abap, agent, apm, html
- Language: ABAP
- Homepage: https://abappm.com
- Size: 82 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://github.com/abapPM/ABAP-HTTP-Agent/blob/main/LICENSE)
[](https://github.com/abapPM/.github/blob/main/CODE_OF_CONDUCT.md)
[](https://api.reuse.software/info/github.com/abapPM/ABAP-HTTP-Agent)# HTTP Agent
Easy to use HTTP agent and login manager with request/response handling.
NO WARRANTIES, [MIT License](https://github.com/abapPM/ABAP-HTTP-Agent/blob/main/LICENSE)
## Usage
Initialize an HTTP agent and set header fields:
```abap
DATA(agent) = zcl_http_agent=>create( )." Optionally set headers
agent->global_headers( )->set(
iv_key = zif_http_agent=>c_header-accept
iv_val = zif_http_agent=>c_content_type-json ).agent->global_headers( )->set(
iv_key = zif_http_agent=>c_header-content_type
iv_val = zif_http_agent=>c_content_type-json ).agent->global_headers( )->set(
iv_key = zif_http_agent=>c_header-user_agent
iv_val = `abap 7.5` ).
```Get and set authorization tokens:
```abap
DATA(host) = 'api.github.com'.IF zcl_http_login_manager=>get( host ) IS NOT INITIAL.
agent->global_headers( )->set(
iv_key = zif_http_agent=>c_header-authorization
iv_val = zcl_http_login_manager=>get( host ) ).
ENDIF.
```Get request:
```abap
DATA(response) = agent->request( url = 'https://api.github.com/emojis' ).IF response->is_ok( ) = abap_false.
message = |Error { response->code( ) }|.
ENDIF.
```Put request with payload:
```abap
DATA(response) = agent->request(
url = 'https://myserver.com/'
method = zif_abappm_http_agent=>c_method-put
payload = json ).IF response->is_ok( ) = abap_false.
message = |Error { response->code( ) }|.
ENDIF.
```## Prerequisites
SAP Basis 7.50 or higher
## Installation
Install `http-agent` as a global module in your system using [apm](https://abappm.com).
or
Specify the `http-agent` module as a dependency in your project and import it to your namespace using [apm](https://abappm.com).
## Contributions
All contributions are welcome! Read our [Contribution Guidelines](https://github.com/abapPM/ABAP-HTTP-Agent/blob/main/CONTRIBUTING.md), fork this repo, and create a pull request.
You can install the developer version of ABAP HTTP Agent using [abapGit](https://github.com/abapGit/abapGit) either by creating a new online repository for `https://github.com/abapPM/ABAP-HTTP-Agent`.
Recommended SAP package: `$HTTP-AGENT`
## About
Made with ❤ in Canada
Copyright 2025 apm.to Inc.
Follow [@marcf.be](https://bsky.app/profile/marcf.be) on Blueksy and [@marcfbe](https://linkedin.com/in/marcfbe) or LinkedIn