API Integration #1377
Unanswered
lcunha1998
asked this question in
Q&A
API Integration
#1377
Replies: 1 comment
-
Two things:
From: https://github.com/PrivateBin/PrivateBin/wiki/API {"status": 0, "id": "[pasteID]", "url": "[serverAddress?pasteID]", "deletetoken": "[deleteToken]"} More details on the URL format: https://github.com/PrivateBin/PrivateBin/wiki/Encryption-format#url-format-of-the-paste
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the problem/question
I need to integrate api via powershell and i am without success getting the response url
Did you use the FAQ section?
What you did?
1.# Variables
$privateBinUrl = "https://privatebin.shared.cloud.int/api/v2/paste"
$content = "This is the content of your paste"
$pasteData = @{
v = 2
a = 0
paste = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($content))
expire = "1day" # options: "5min", "10min", "1hour", "1day", "1week", "1month", "1year", "never"
}
Convert data to JSON
$jsonData = $pasteData | ConvertTo-Json -Compress
Ignore SSL errors (only for testing purposes, not recommended for production)
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
try {
# Send POST request
$response = Invoke-RestMethod -Uri $privateBinUrl -Method Post -Body $jsonData -ContentType "application/json"
# Output response
Write-Output "Paste created successfully: $($response.url)"
} catch {
Write-Error "Failed to create paste: $_"
}
Paste created successfully:
but doesnt show the paste
What happens
no link is generated
What should happen
give me a link
Additional information
No response
Server address
https://privatebin.shared.cloud.int/
Server OS
No response
Webserver
No response
PrivateBin version
1.5.1
Browser and version
No response
Local operating system and version
No response
Issue reproducibility
No, I cannot reproduce it on https://privatebin.net.
Beta Was this translation helpful? Give feedback.
All reactions