Commit 05b1a8c1 authored by Σταύρος Παπαδάκης's avatar Σταύρος Παπαδάκης

Merge branch 'samples' into 'master'

GET call samples

See merge request !5
parents 1fca1ec4 1a07d005
......@@ -40,3 +40,11 @@
- **id** (κείμενο)
- δέχεται δεδομένα στο query string
- καλείται με μέθοδο κλήσης **GET**
**Δείγματα**
| Γλώσσα | Αρχείο |
| ------ | ------ |
| Command line curl | [verify_get.sh](sh/verify_get.sh) |
| PHP | [verify_get.php](php/verify_get.php) |
<?php
$auth = "Bearer <token>";
$params = http_build_query(["id" => "0123"]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://wso2.local.dev:8243/identity/1.0.0/verify?{$params}");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: {$auth}",
"Accept: application/json",
"User-Agent: WSO2 sample php caller"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo "Error: ", curl_error($ch),
"Curl info: ", var_export(curl_getinfo($ch), true);
$result = false;
} else {
// possibly parse result...
$result = json_decode($result, true);
}
curl_close($ch);
return $result;
#!/bin/sh
curl -X GET \
--header "Accept: application/json" \
--header "Authorization: Bearer <token>" \
--header "User-Agent: WSO2 sample command line caller" \
'https://wso2.local.dev:8243/identity/1.0.0/verify?id=0123'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment