Skip to content

Instantly share code, notes, and snippets.

@LogicalAddress-Lab
Last active October 14, 2021 12:36
Show Gist options
  • Save LogicalAddress-Lab/fcfe511a69821631974ea7e2e6537721 to your computer and use it in GitHub Desktop.
Save LogicalAddress-Lab/fcfe511a69821631974ea7e2e6537721 to your computer and use it in GitHub Desktop.

Curl

curl --location -g --request POST 'https://cmr.cvis.ng/api/services' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.' \
--header 'Content-Type: application/json' \
--data-raw '{
    "customerName": "Retnan Daser",
    "customerPhone": "2348057374422",
    "plateNumber": "YAB311TT",
    "chassisNumber": "TEST4345K8F85",
    "engineNumber": "TESTFGA2232318",
    "customerAddress": "No 4 Tonimas Estate Katampe Abuja.",
    "vehicleColour": "BLUE",
    "tx": "12715217223121",
    "serviceName": "Roadworthiness Certificate",
    "serviceCode": "7870920418",
    "agentName": "Mary-Jane",
    "agentMonitor": "Service Client",
    "centre": "Onex Center",
    "vehicleType": "private",
    "vehicleMake": "Ford",
    "vehicleCategory": "Jeep/SUV",
    "vehicleModel": "EXPLORER",
    "status": "paid",
    "serviceType": "vehicle",
    "serviceCategory": "vehicle",
    "dataSource": "Evas",
    "agentContact": "retnan@evas.ng",
    "cost": "2500",
    "paymentType": "legacy",
    "currency": "NGN",
    "paymentMode": "recurring",
    "durationInMonth": 12,
    "expiry": "2019-12-06",
    "paidAt": "2018-12-06"
}'

js

var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "customerName": "Retnan Daser",
  "customerPhone": "2348057374422",
  "plateNumber": "YAB311TT",
  "chassisNumber": "TEST4345K8F85",
  "engineNumber": "TESTFGA2232318",
  "customerAddress": "No 4 Tonimas Estate Katampe Abuja.",
  "vehicleColour": "BLUE",
  "tx": "12715217223121",
  "serviceName": "Roadworthiness Certificate",
  "serviceCode": "7870920418",
  "agentName": "Mary-Jane",
  "agentMonitor": "Service Client",
  "centre": "Onex Center",
  "vehicleType": "private",
  "vehicleMake": "Ford",
  "vehicleCategory": "Jeep/SUV",
  "vehicleModel": "EXPLORER",
  "status": "paid",
  "serviceType": "vehicle",
  "serviceCategory": "vehicle",
  "dataSource": "Evas",
  "agentContact": "mj@evas.ng",
  "cost": "2500",
  "paymentType": "legacy",
  "currency": "NGN",
  "paymentMode": "recurring",
  "durationInMonth": 12,
  "expiry": "2019-12-06",
  "paidAt": "2018-12-06"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://cmr.cvis.ng/api/services/api/services", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://cmr.cvis.ng/api/services/api/services',
  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 =>'{
    "customerName": "Retnan Daser",
    "customerPhone": "2348057374422",
    "plateNumber": "YAB311TT",
    "chassisNumber": "TEST4345K8F85",
    "engineNumber": "TESTFGA2232318",
    "customerAddress": "No 4 Tonimas Estate Katampe Abuja.",
    "vehicleColour": "BLUE",
    "tx": "12715217223121",
    "serviceName": "Roadworthiness Certificate",
    "serviceCode": "7870920418",
    "agentName": "Mary-Jane",
    "agentMonitor": "Service Client",
    "centre": "Onex Center",
    "vehicleType": "private",
    "vehicleMake": "Ford",
    "vehicleCategory": "Jeep/SUV",
    "vehicleModel": "EXPLORER",
    "status": "paid",
    "serviceType": "vehicle",
    "serviceCategory": "vehicle",
    "dataSource": "Evas",
    "agentContact": "mj@evas.ng",
    "cost": "2500",
    "paymentType": "legacy",
    "currency": "NGN",
    "paymentMode": "recurring",
    "durationInMonth": 12,
    "expiry": "2019-12-06",
    "paidAt": "2018-12-06"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("https://cmr.cvis.ng/api/services")
payload = json.dumps({
  "customerName": "Retnan Daser",
  "customerPhone": "2348057374422",
  "plateNumber": "YAB311TT",
  "chassisNumber": "TEST4345K8F85",
  "engineNumber": "TESTFGA2232318",
  "customerAddress": "No 4 Tonimas Estate Katampe Abuja.",
  "vehicleColour": "BLUE",
  "tx": "12715217223121",
  "serviceName": "Roadworthiness Certificate",
  "serviceCode": "7870920418",
  "agentName": "Mary-Jane",
  "agentMonitor": "Service Client",
  "centre": "Onex Center",
  "vehicleType": "private",
  "vehicleMake": "Ford",
  "vehicleCategory": "Jeep/SUV",
  "vehicleModel": "EXPLORER",
  "status": "paid",
  "serviceType": "vehicle",
  "serviceCategory": "vehicle",
  "dataSource": "Evas",
  "agentContact": "mj@evas.ng",
  "cost": "2500",
  "paymentType": "legacy",
  "currency": "NGN",
  "paymentMode": "recurring",
  "durationInMonth": 12,
  "expiry": "2019-12-06",
  "paidAt": "2018-12-06"
})
headers = {
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..',
  'Content-Type': 'application/json'
}
conn.request("POST", "/api/services", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment