Trying to replicate the steps in
$Text = ‘your_email@domain.com:your_user_api_token’ $Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text) $EncodedText = [Convert]::ToBase64String($Bytes) $EncodedText
throws error '$Text' is not recognized as an internal or external command,
operable program or batch file.
'$Bytes' is not recognized as an internal or external command,
operable program or batch file.
'$EncodedText' is not recognized as an internal or external command,
operable program or batch file.
I am using Windows.
please let me know what am I doing wrong?
Not sure if i need some extra access or permissions.
Hello @Venneesha ,
The code looks a little strange. Do you want to use the Powershell script to access data via Confluence REST API?
If yes, you can save the script as .ps1 file and run it with Pshell cli tool:
'confluence.ps1'
$Text = ‘your_email@domain.com:your_user_api_token’
$Bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
$EncodedText = [Convert]::ToBase64String($Bytes)
$EncodedText
On WIndows just open Powershell and run it
.\confluence.ps1
On Linux (Ubuntu)
pwsh confluence.ps1
thanks for the response @Andrii Maliuta .
Can you please let me know the process for Gitbash or from cmd please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Install Powershell (https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.3) as CMD or GItBash need to have PS on PATH.
After you install it and it is present in system PATH, you can just use the 'pwsh' and specify the script file name as a parameter to run it:
``` pwsh SCRIPT_NAME.ps1 ```
Please note that you can use any CLI tool (HTTP client) to interact with Confluence REST API , like: Curl, Httpie, Any programming language client, etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Appreciate your resposne@Andrii Maliuta
I was unable to install powershell as I am working on my company laptop and so asking the commands for gitbash. Even VS code should be fine.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, sure, you can use any tool, but using VS Code, anyway you need to install the Powershell addon/extension - It will just do installation and configuration for you.
Please note that PShell is a framework: command-line shell, a scripting language, and a configuration management framework, so it is required anyway on your laptop - it is up to you how to get it: installing with executable, binary archive, some addon inside other tool, etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.