# HttpHeaders.GetValues(Text, Array of [Text]) Method
> Version: _Available or changed with runtime version 1.0._
Gets the values for the specified key.
## Syntax
```al
[Ok := ]  HttpHeaders.GetValues(Key: Text, Values: Array of [Text])
```
## Parameters
HttpHeaders
Type: httpheaders-data-type
An instance of the httpheaders-data-type data type.
Key
Type: ../text/text-data-type
The specified header.
Values
Type: ../text/text-data-type
The specified header values.
## Return Value
*[Optional] Ok*
Type: ../boolean/boolean-data-type
true if the specified header name and values are stored in the collection; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
## Example
This example demonstrates:
 Adding multiple values to the same header name (Accept header with different MIME types)
 Retrieving header values using the GetValues() method
 Checking the return value to ensure the header exists
 Iterating through the array to process each value
 Practical use case with response headers like Set-Cookie that often have multiple values
```al
procedure ExampleGetValues()
var
    HttpClient: HttpClient;
    HttpRequestMessage: HttpRequestMessage;
    HttpResponseMessage: HttpResponseMessage;
    HttpHeaders: HttpHeaders;
    HeaderValues: array[10] of Text;
    HeaderKey: Text;
    i: Integer;
    Success: Boolean;
begin
    // Initialize HTTP request
    HttpRequestMessage.Method := 'GET';
    HttpRequestMessage.SetRequestUri('https://api.example.com/data');

    // Add multiple values for the same header (for example, Accept header)
    HttpHeaders := HttpRequestMessage.GetHeaders();
    HttpHeaders.Add('Accept', 'application/json');
    HttpHeaders.Add('Accept', 'application/xml');
    HttpHeaders.Add('Accept', 'text/plain');

    // Get the values for the Accept header
    HeaderKey := 'Accept';
    Success := HttpHeaders.GetValues(HeaderKey, HeaderValues);

    if Success then begin
        Message('Found %1 values for header %2:', ArrayLen(HeaderValues), HeaderKey);

        // Display each value
        for i := 1 to ArrayLen(HeaderValues) do begin
            if HeaderValues[i] <> '' then
                Message('Value %1: %2', i, HeaderValues[i]);
        end;
    end else begin
        Message('Header %1 not found or has no values', HeaderKey);
    end;

    // Send the request
    if HttpClient.Send(HttpRequestMessage, HttpResponseMessage) then begin
        // Process response headers
        HttpHeaders := HttpResponseMessage.GetHeaders();

        // Check for Set-Cookie headers (servers often send multiple)
        HeaderKey := 'Set-Cookie';
        Clear(HeaderValues);

        if HttpHeaders.GetValues(HeaderKey, HeaderValues) then begin
            Message('Response contains cookies:');
            for i := 1 to ArrayLen(HeaderValues) do begin
                if HeaderValues[i] <> '' then
                    Message('Cookie %1: %2', i, HeaderValues[i]);
            end;
        end;
    end;
end;
```
## Related information
httpheaders-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/httpheaders/httpheaders-getvalues-string-text-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/httpheaders/httpheaders-getvalues-string-text-method/
