Description
Sets the HTTP request header.
Applies to
Syntax
applicationname.SetHttpRequestHeader ( string headerName, string headerValue{, Boolean replace } )
Argument |
Description |
---|---|
applicationname |
The name of the application object in which you want to set the request header. |
headerName |
A string whose value is the header name. |
headerValue |
A string whose value is the header value. |
replace (optional) |
A boolean determines whether to replace the current existing request value if the same header name already exists.
Note: use this argument cautiously (TRUE is recommended) when you specify the charset in the "Content-Type" header, because no more than one charset is allowed. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs or if the current application is not an installable cloud app deployed with PowerServer. If any argument's value is null, the method returns null.
Examples
Long ll_Return String ls_TokenType, ls_AccessToken, ls_Json JsonParser ljson_Parser ljson_Parser = Create JsonParser ls_Json = '{' +& ' "access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjM4OEQ0NEIxRDdBNkVFOUQxNTU0MDAzQUMzM0QzQzkzIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2MTI0MDIxODUsImV4cCI6MTYxMjQwMjM2NSwiaXNzIjoiaHR0cHM6Ly9sb2NhbGhvc3Q6NTAwMSIsImNsaWVudF9pZCI6IllvdXJDbGllbnRJZFRoYXRDYW5Pbmx5UmVhZCIsInN1YiI6IlBBTkdDSFVHVUFOIiwiYXV0aF90aW1lIjoxNjEyNDAyMTg1LCJpZHAiOiJsb2NhbCIsImp0aSI6IjFDNEQ4NEFBODU0REYxODMwQkVGQTAwQTFBMjdFMDk0IiwiaWF0IjoxNjEyNDAyMTg1LCJzY29wZSI6WyJzY29wZS5yZWFkYWNjZXNzIl0sImFtciI6WyJjdXN0b20iXX0.DbJsip696O1HlTFjAmayohhHGEcjIQxJM7JICi9ho5MAv2Av4YjQOGgXrCNFhwqG4AFTf3hHwufGYXxzXI8tCYfn3F3ro36dd-0h_A-__5sBelZD0vr6nmWh8Uy-zoJenzsrnVEv8VHVNi2enuKH6SBe-Q59bn5A-Gbg6viNjv0S5HIaKuWeawExBH6uEAu28RlSlfG2bwWuCsyhYWOPIhNhYcZTbVD8ks0SFodGeGS-ZqNOVrOTKb9oqnhvYxnuNofJpjToZ8ZZdKyWiyJUhItpTQTyI3MsCHoVU4X101YTPrVMF_-OuPSwXm6QMl3QtI_6Hy_PeYHL-xz2-q3tog",' +& ' "expires_in": 3600,' +& ' "token_type": "Bearer",' +& ' "scope": "scope.readaccess"' +& '}' ljson_Parser.LoadString( ls_Json ) ls_TokenType = ljson_Parser.GetItemString( "/token_type" ) ls_AccessToken = ljson_Parser.GetItemString( "/access_token" ) ll_Return = Getapplication().SetHttpRequestHeader( "Authorization", ls_TokenType + " " + ls_AccessToken, True ) If IsValid ( ljson_Parser ) Then Destroy ( ljson_Parser )
See also