Adding fields to add values in headers

Created on 20 April 2021, almost 4 years ago
Updated 21 March 2024, 11 months ago

Problem/Motivation

We need to make a request to an API with values to pass in Headers.

Steps to reproduce

Go to 'Structure' > Create an 'External entity' > 'Storage' > Enter API values

Proposed resolution

I suggest to replace the current 'Header name' field or add a new textarea field where we can enter our header values.

API changes

Add the values entered in this new field in the API request.

The values has to be entered like this template:

key1:value
key2:value
Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇫🇷France jgosset

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada colan Toronto 🇨🇦

    I didn't run a `diff`, but at a quick glance, the patch and the MR look the same. Let's work in the MR though? Patches can just be for Composer.

  • 🇨🇦Canada colan Toronto 🇨🇦
  • 🇨🇦Canada colan Toronto 🇨🇦
    +++ b/src/Plugin/ExternalEntities/StorageClient/Rest.php
    @@ -180,41 +170,57 @@ class Rest extends ExternalEntityStorageClientBase implements PluginFormInterfac
    +      $sequence[$exploded[0]] = $value;
    

    Would it make sense to add a Token::replacePlain() in here to expand tokens in values?

    In our case, users will each have an ID that they pass in for authentication & authorization so it'll be something like [User:remoteID].

  • 🇫🇷France guignonv

    On v3, this is currently handled for a single custom header (ie. "Custom header" option in the "Authentication" section). Do you need more than one header item or could some of them be passed to the other section "HTTP protocol > Additional HTTP headers"?

    Should an event be added to support more header customization?

Production build 0.71.5 2024