File size: 21,490 Bytes
89a1081 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | @extends($layout)
@section('panel')
@push('style-push')
<link rel="stylesheet" href="{{asset('assets/theme/admin/css/prism.css')}}" />
<link rel="stylesheet" href="{{asset('assets/theme/admin/css/code-box-copy.min.css')}}"/>
@endpush
<div class="page-title-wrapper">
<div class="page-title-left">
<h2 class="page-title ">{{ translate('Api Document')}}</h2>
</div>
<div class="page-title-right">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Create</li>
</ol>
</nav>
</div>
</div>
<section>
<div class="container-fluid p-0">
<div class="row">
<div class="col-lg-12">
<div class="card mb-3">
<div class="card-header">
<h4 class="card-title">{{ translate('Documention')}}</h4>
</div>
<div class="card-body">
<h6 class="mb-1">{{ translate('Before you get started') }}</h6>
<div class="lead mb-5">
A brief overview of the API and its purpose <br>
<strong>Endpoints:</strong> A list of all the endpoints available in the API, including their URLs and the HTTP methods they support.
<br>
<strong>Request and Response:</strong> The expected request format and the format of the response, including examples of how to use the API and the data that it returns.
</div>
<h6 class="mb-1">{{ translate('Send Email') }}</h6>
<div class="lead custiom-accordion mb-5">
<div class="accordion accordion-flush" id="emailSend">
<div class="accordion-item mb-3">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseEmail" aria-expanded="true" aria-controls="collapseEmail">
<span class="badge bg--primary">
POST
</span>
<span>{{route('incoming.email.send')}}</span>
</button>
</h2>
<div id="collapseEmail" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#emailSend">
<div class="accordion-body">
<strong>This PHP method uses cURL to send email data to an API endpoint,</strong> receiving a <code>JSON response</code> with email request status and logs.
<div class="code-box-copy">
<button class="code-box-copy__btn" data-clipboard-target="#code-block-email-send" title="Copy"></button>
<pre>
<code id="code-block-email-send" class="language-php">
$curl = curl_init();
$postdata = array(
"contact" => array(
array(
"subject" => "demo list info",
"email" => "receiver1@email.com",
"message" => "In publishing and graphic design, Lorem ipsum text",
"sender_name" => "name",
"reply_to_email" => "demo@gmail.com"
),
array(
"subject" => "demo list info",
"email" => "receiver2@email.com",
"message" => "1",
"sender_name" => "name",
"reply_to_email" => "demo@gmail.com"
)
)
);
curl_setopt_array($curl, array(
CURLOPT_URL => '{{route('incoming.email.send')}}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>json_encode($postdata),
CURLOPT_HTTPHEADER => array(
'Api-key: ###########################,
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
//response will return data in this format
{
"status": "success",
"email_logs": [
{
"uid": "20034f80-f778-4d3e-a636-5c1f161b954f",
"email": "receiver1@email.com",
"status": "Pending",
"created_at": "2023-10-16 04:14 PM"
},
{
"uid": "c4ad7ae2-3cfd-4066-ab31-4d31c3d078db",
"email": "receiver2@email.com",
"status": "Pending",
"created_at": "2023-10-16 04:14 PM"
}
],
"message": "New Email request sent, please see in the Email history for final status"
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item accordion-flush">
<h2 class="accordion-header" id="headingEmailStatus">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseEmailStatus" aria-expanded="false" aria-controls="collapseEmailStatus">
<span class="badge bg--success">
GET
</span>
<span>{{url('api/get/email/{uid}')}}</span>
</button>
</h2>
<div id="collapseEmailStatus" class="accordion-collapse collapse" aria-labelledby="headingEmailStatus" data-bs-parent="#emailSend">
<div class="accordion-body">
<strong>Using cURL, this PHP code fetches email log details for a specific identifier (uid) from an API, including recipient email, content, status, and the latest update time.</strong>
<div class="code-box-copy">
<button class="code-box-copy__btn" data-clipboard-target="#code-block-email-send" title="Copy"></button>
<pre>
<code id="code-block-email-send" class="language-php">
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '{{url('api/get/email/{uid}')}}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Api-key: ###########################,
),
));
$response = curl_exec($curl);
curl_close($curl);
//response will return data in this format
{
"status": "success",
"email_logs": {
"uid": "60aca9dd-ce15-451c-b8d8-86ca01b0",
"email": "receiver1@email.com",
"content": "some content",
"status": "Pending",
"updated_at": "2023-10-16 08:15 PM"
}
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<h6 class="mb-1">{{ translate('Send SMS') }}</h6>
<div class="lead custiom-accordion mb-5">
<div class="accordion accordion-flush" id="smsSend">
<div class="accordion-item mb-3">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseSms" aria-expanded="false" aria-controls="collapseEmail">
<span class="badge bg--primary">
POST
</span>
<span>{{route('incoming.sms.send')}}</span>
</button>
</h2>
<div id="collapseSms" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#smsSend">
<div class="accordion-body">
<strong>This PHP method sends SMS messages via cURL to an API endpoint, </strong>receiving a <code>JSON response</code> with SMS request status and logs.
<div class="code-box-copy">
<button class="code-box-copy__btn" data-clipboard-target="#code-block-email-send" title="Copy"></button>
<pre>
<code id="code-block-email-send" class="language-php">
$curl = curl_init();
$postdata = array(
"contact" => array(
array(
"number" => "11254352345",
"body" => "In publishing and graphic design, Lorem ipsum is a",
"sms_type" => "plain"
),
array(
"number" => "32234213423",
"body" => "In publishing and graphic design, Lorem ipsum is a",
"sms_type" => "unicode"
)
)
);
curl_setopt_array($curl, array(
CURLOPT_URL => '{{route('incoming.sms.send')}}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>json_encode($postdata),
CURLOPT_HTTPHEADER => array(
'Api-key: ###########################,
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
curl_close($curl);
//response will return data in this format
{
"status": "success",
"sms_logs": [
{
"uid": "5eb8c1b2-6832-4c91-a813-6e06062c8584",
"number": "11254352345",
"status": "Pending",
"created_at": "2023-10-16 04:59 PM"
},
{
"uid": "3d783e68-8f87-4374-a6b4-d07d23b30fff",
"number": "32234213423",
"status": "Pending",
"created_at": "2023-10-16 04:59 PM"
}
],
"message": "New SMS request sent, please see in the SMS history for final status"
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingEmailStatus">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseSmsStatus" aria-expanded="false" aria-controls="collapseEmailStatus">
<span class="badge bg--success">
GET
</span>
<span>{{url('api/get/sms/{uid}')}}</span>
</button>
</h2>
<div id="collapseSmsStatus" class="accordion-collapse collapse" aria-labelledby="headingEmailStatus" data-bs-parent="#emailSend">
<div class="accordion-body">
<strong>This PHP code, employing cURL, retrieves SMS log data for a unique identifier (uid) from an API, including status, recipient number, message content, and the last update timestamp.</strong>
<div class="code-box-copy">
<button class="code-box-copy__btn" data-clipboard-target="#code-block-email-send" title="Copy"></button>
<pre>
<code id="code-block-email-send" class="language-php">
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '{{url('api/get/sms/{uid}')}}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Api-key: ###########################,
),
));
$response = curl_exec($curl);
curl_close($curl);
//response will return data in this format
{
"status": "success",
"sms_logs": {
"uid": "43339822-9d44-413e-b8b6-5cafc8be",
"number": "11254352345",
"content": "In publishing and graphic design, Lorem ipsum is a",
"status": "Schedule",
"updated_at": "2023-10-16 08:10 PM"
}
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<h6 class="mb-1">{{ translate('Send Whatsapp') }}</h6>
<div class="lead custiom-accordion mb-5">
<div class="accordion accordion-flush" id="whatsappSend">
<div class="accordion-item mb-3">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWhatsapp" aria-expanded="false" aria-controls="collapseEmail">
<span class="badge bg--primary">
POST
</span>
<span>{{route('incoming.whatsapp.send')}}</span>
</button>
</h2>
<div id="collapseWhatsapp" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#whatsappSend">
<div class="accordion-body">
<strong>This PHP method uses cURL to send WhatsApp messages via an API, offering features like text and media messages. The response contains the status of the sent messages and directs users to check the WhatsApp Log history for final status.</strong>
<div class="code-box-copy">
<button class="code-box-copy__btn" data-clipboard-target="#code-block-email-send" title="Copy"></button>
<pre>
<code id="code-block-email-send" class="language-php">
$curl = curl_init();
$postdata = array(
"contact" => array(
array(
"number" => "880123456789",
"message" => "In publishing and graphic design, Lorem ipsum"
),
array(
"number" => "880123456789",
"message" => "In publishing and graphic design, Lorem ipsum",
"media" => "image",
"url" => "https://example.com/image.jpeg"
),
array(
"number" => "880123456799",
"message" => "In publishing an audio file, Lorem ipsum",
"media" => "audio",
"url" => "https://example.com/audio.mp3"
),
array(
"number" => "880123456799",
"message" => "In publishing a video file, Lorem ipsum",
"media" => "video",
"url" => "https://example.com/video.mp4"
),
array(
"number" => "880123456799",
"message" => "In publishing a document file, Lorem ipsum",
"media" => "document",
"url" => "https://example.com/document.pdf"
)
)
);
curl_setopt_array($curl, array(
CURLOPT_URL => '{{route('incoming.whatsapp.send')}}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>json_encode($postdata),
CURLOPT_HTTPHEADER => array(
'Api-key: ###########################,
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
curl_close($curl);
//response will return data in this format
{
"status": "success",
"whatsapp_logs": [
{
"uid": "b6ca078b-8a6d-4293-8118-b1498d4588aa",
"to": "880123456789",
"status": "Pending",
"created_at": "2023-10-16 08:04 PM"
},
{
"uid": "83beaaae-27d1-42fd-879d-464e393990d8",
"to": "880123456789",
"status": "Pending",
"created_at": "2023-10-16 08:04 PM"
},
{
"uid": "66c54d4b-b02e-41ab-9651-6805a7679dcb",
"to": "880123456799",
"status": "Pending",
"created_at": "2023-10-16 08:04 PM"
},
{
"uid": "ed4a8aa8-820b-4019-b889-b93ebcd7a636",
"to": "880123456799",
"status": "Pending",
"created_at": "2023-10-16 08:04 PM"
},
{
"uid": "9ade281f-341d-49bb-9a8f-f43c47f0cc8c",
"to": "880123456799",
"status": "Pending",
"created_at": "2023-10-16 08:04 PM"
}
],
"message": "New WhatsApp Message request sent, please see in the WhatsApp Log history for final status"
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingEmailStatus">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWhatsappStatus" aria-expanded="false" aria-controls="collapseEmailStatus">
<span class="badge bg--success">
GET
</span>
<span>{{url('api/get/whatsapp/{uid}')}}</span>
</button>
</h2>
<div id="collapseWhatsappStatus" class="accordion-collapse collapse" aria-labelledby="headingEmailStatus" data-bs-parent="#emailSend">
<div class="accordion-body">
<strong>Using cURL, this PHP code fetches WhatsApp log data for a unique identifier (uid) from an API, including recipient number, message content, status, and the latest update time.</strong>
<div class="code-box-copy">
<button class="code-box-copy__btn" data-clipboard-target="#code-block-email-send" title="Copy"></button>
<pre>
<code id="code-block-email-send" class="language-php">
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '{{url('api/get/whatsapp/{uid}')}}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Api-key: ###########################,
),
));
$response = curl_exec($curl);
curl_close($curl);
//response will return data in this format
{
"status": "success",
"whats_log": {
"uid": "f2e43ee3-7fd5-4587-9f10-0e686c3b",
"number": "880123456789",
"content": "In publishing and graphic design, Lorem ipsum",
"status": "Pending",
"updated_at": "2023-10-16 08:19 PM"
}
}
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@push('script-include')
<script src="{{asset('assets/theme/admin/js/prism.js')}}"></script>
<script src="{{asset('assets/theme/admin/js/clipboard.min.js')}}"></script>
<script src="{{asset('assets/theme/admin/js/code-box-copy.min.js')}}"></script>
@endpush
@push('script-push')
<script>
"use strict";
(function($) {
$('.code-box-copy').codeBoxCopy({
tooltipText: 'Copied',
tooltipShowTime: 1000,
tooltipFadeInTime: 300,
tooltipFadeOutTime: 300
});
})(jQuery);
</script>
@endpush
|