Practitioner - Incoming webhooks


Getting Started

Endpoint

https://www.doctori.ma/webhooks
Method URI Headers
POST /webhooks Doctori-Signature

URL Params

None

Created/Updated

Fields

Property Type Default Description
type String required Event type practitioner_created/practitioner_updated
timestamps Timestamps current timestamps When the event has been occurred
practitioner Object required Practitioner
  id Integer unsigned nullable Primary key
  uuid String required e.g: 72e449a8-78e1-4256-b8c8-b4c4b1eb3588
  email String required e.g: ech.chebaby@gmail.com
  firstname Object required e.g: {"fr": "Nour-Eddine", "ar": "نورالدين"}
  lastname Object required e.g: {"fr": "ECH-CHEBABY", "ar": "الشبابي"}
  slug String required Full name slugified e.g: nour-eddine-ech-chebaby
  password String required The practitioner password
  type String required "doctor" or "therapist"
  gender String required "m" or "f" (m: male, f: female)
  is_active Boolean false false or true
  verified_at DeteTime nullable when the practitioner verify his email
  confirmed_at DeteTime nullable when the admin confirms the practitioner's account
  certified_at DeteTime nullable when the admin verify practitioner's credentials
  mobile String nullable Preferably with a dial code e.g: "+212601548257"
  dial_code String nullable e.g: "+212"
  visits_count Integer unsigned 0 Profile visits counter
  phone_requests_count Integer unsigned 0 How many times practitioner phone number been requested
  reviews_count Integer unsigned 0 Reviews counter
  rating_average Float {8,2} nullable Rating average
  facebook String nullable URL
  twitter String nullable URL
  youtube String nullable URL
  description String nullable Description : Presentation of the clinic
  info String nullable Info : Access details
  credentials String nullable Credentials: Diploma and Training
  career String nullable Career
  specialities Array required Practitioner's specialities
  speciality Object required Speciality
   &nbspid Integer unsigned nullable Primary key
    uuid String required e.g: 55265c06-c920-404a-964a-f594ab5e4a59
    name Object required e.g: {"fr": "Orthodontiste", "ar": "أخصائي في تقويم الاسنان"}
    plural Object required e.g: {"fr": "Orthodontistes", "ar": "الأطباء المتخصصين في تقويم الاسنان"}
    slug String required Name slugified e.g: orthodontiste
  establishments Array required Establishments to which the practitioner belongs
  establishment Object required Establishment
    id Integer unsigned nullable Primary key
    uuid String required e.g: 14222885-08e7-421f-9722-39a0920d2f0d
    type String required "office" or "clinic"
    name Object required e.g: {"fr": "Ibn-Sina", "ar": "ابن سينا"}
    slug String required Name slugified e.g: ibn-sina
    email String required e.g: contact@ibnsina.ma
    phone_number String nullable Preferably with a dial code e.g: "+212528238549"
    dial_code String nullable e.g: "+212"
    is_active Boolean false false or true
    fax String nullable Preferably with a dial code e.g: "+212528238549"
    address Object nullable e.g: {"fr": "Avenue Hassan 1er, El-Massira", "ar": "شارع الحسن الأول، حي المسيرة"}
    city Object required City
      id Integer unsigned nullable Primary key
      uuid String required e.g: f4fa835a-2ee5-438a-b0cd-1eb88bcff49c
      name Object required e.g: {"fr": "Agadir", "ar": "أكادير"}
      lat String nullable Latitude e.g: 30.427755
      lng String nullable Longitude e.g: -9.598107
      place_id String nullable e.g: IhoSGAoUChIJ0U6OoscfqokR6P225pApu2UQDQ
      postal_code String nullable e.g: 80000
  services Array required Practitioner's services
  service Object required Service
    id Integer unsigned nullable Primary key
    uuid String required e.g: bb307622-ee90-3abf-8f03-fee068deac65
    name Object required e.g: {"fr": "Cardiologie pédiatrique", "ar": "أمراض القلب للأطفال"}
    slug String required Name slugified e.g: cardiologie-pediatrique
    speciality Object required Speciality
      id Integer unsigned nullable Primary key
      uuid String required e.g: 8cdbef50-9b1a-3f5c-a79b-288027d5efea
      name Object required e.g: {"fr": "Cardiologue", "ar": "أخصائي في أمراض القلب"}
      plural Object required e.g: {"fr": "Cardiologues", "ar": "الأطباء المتخصصين في أمراض القلب"}
      slug String required Name slugified e.g: cardiologue
  motives Array required Practitioner's motives
  motive Object required Motive
    id Integer unsigned nullable Primary key
    uuid String required e.g: 3f674f04-f20a-3579-86be-dc248e0852bc
    name Object required e.g: {"fr": "Renouvellement de traitement", "ar": "تجديد العلاج"}
    slug String required Name slugified e.g: renouvellement-de-traitement
    speciality Object required Speciality
      id Integer unsigned nullable Primary key
      uuid String required e.g: ba4f38c6-e595-3a1d-b32f-5d83d84eac44
      name Object required e.g: {"fr": "Médecin généraliste", "ar": "طبيب عام"}
      plural Object required e.g: {"fr": "Médecins généralistes", "ar": "الأطباء العامين"}
      slug String required Name slugified e.g: medecin-generaliste

JSON representation

{
    "type" : "practitioner_created|practitioner_updated",
    "timestamps" : "20180312092737",
    "practitioner" : {
        "id" : "{unsignedInteger}|null",
        "uuid" : "72e449a8-78e1-4256-b8c8-b4c4b1eb3588",
        "email" : "ech.chebaby@gmail.com",
        "firstname" : {
            "fr" : "Nour-Eddine",
            "ar" : "نورالدين"
        },
        "lastname" : {
            "fr" : "ECH-CHEBABY",
            "ar" : "الشبابي"
        },
        "slug" : "nour-eddine-ech-chebaby",
        "password" : "y$NdCa0P2cdEnBWaj56ewTqO/uiX.3TiF/tPbcC02We/KzSkpHAyvwa",
        "type" : "doctor|therapist",
        "gender" : "m|f",
        "is_active" : "true|false",
        "verified_at" : "{datetime}",
        "confirmed_at" : "{datetime}",
        "certified_at" : "{datetime}",
        "mobile" : "+212601548257",
        "dial_code" : "+212",
        "visits_count" : "{unsignedInteger}",
        "phone_requests_count" : "{unsignedInteger}",
        "reviews_count" : "{unsignedInteger}",
        "rating_average" : "{float}",
        "facebook" : "{url}",
        "twitter" : "{url}",
        "youtube" : "{url}",
        "description" : "{text}",
        "info" : "{text}",
        "credentials" : "{text}",
        "career" : "{text}",
        "created_at" : "{datetime}",
        "updated_at" : "{datetime}", 
        "specialties": [
            {
                "id" : "{unsignedInteger}|null",
                "uuid" : "55265c06-c920-404a-964a-f594ab5e4a59",
                "name" : {
                    "fr" : "Orthodontiste",
                    "ar" : "أخصائي في تقويم الاسنان"
                },
                "plural" : {
                    "fr" : "Orthodontistes",
                    "ar" : "الأطباء المتخصصين في تقويم الاسنان"
                },
                "slug" : "orthodontiste"
            }   
        ],
        "establishments" : [
            {
                "id" : "{unsignedInteger}|null",
                "uuid" : "14222885-08e7-421f-9722-39a0920d2f0d",
                "type" : "office|clinic",
                "name" : {
                    "fr" : "Ibn-Sina",
                    "ar" : "ابن سينا"
                },
                "slug" : "ibn-sina",
                "email" : "contact@ibnsina.ma",
                "phone_number" : "+212528238549",
                "dial_code" : "+212",
                "is_active" : "true|false",
                "fax" : "+212528238549|null",
                "address" : {
                    "fr" : "Avenue Hassan 1er, El-Massira",
                    "ar" : "شارع الحسن الأول، حي المسيرة"
                },
                "city" : {
                    "id" : "{unsignedInteger}|null",
                    "uuid" : "f4fa835a-2ee5-438a-b0cd-1eb88bcff49c",
                    "name" : {
                        "fr" : "Agadir",
                        "ar" : "أكادير"
                    },
                    "lat" : "30.427755|null",
                    "lng" : "-9.598107|null",
                    "place_id" : "{alphaNumeric}|null",
                    "postal_code" : "80000|null"
                }
            }
        ],
        "services" : [
            {
                "id" : "{unsignedInteger}|null",
                "uuid" : "bb307622-ee90-3abf-8f03-fee068deac65",
                "name" : {
                    "fr" : "Cardiologie pédiatrique",
                    "ar" : "أمراض القلب للأطفال"
                },
                "slug" : "cardiologie-pediatrique",
                "speciality" : {
                    "id" : "1|null",
                    "uuid" : "8cdbef50-9b1a-3f5c-a79b-288027d5efea",
                    "name" : {
                        "fr" : "Cardiologue",
                        "ar" : "أخصائي في أمراض القلب"
                    },
                    "plural" : {
                        "fr" : "Cardiologues",
                        "ar" : "الأطباء المتخصصين  في أمراض القلب"
                    },
                    "slug" : "cardiologue"
                }
            }
        ],
        "motives" : [
            {
                "id" : "{unsignedInteger}|null",
                "uuid" : "3f674f04-f20a-3579-86be-dc248e0852bc",
                "name" : {
                    "fr" : "Renouvellement de traitement",
                    "ar" : "تجديد العلاج"
                },
                "slug" : "renouvellement-de-traitement",
                "speciality" : {
                    "id" : "{unsignedInteger}|null",
                    "uuid" : "ba4f38c6-e595-3a1d-b32f-5d83d84eac44",
                    "name" : {
                        "fr" : "Médecin généraliste",
                        "ar" : "طبيب عام"
                    },
                    "plural" : {
                        "fr" : "Médecins généralistes",
                        "ar" : "الأطباء العامين"
                    },
                    "slug" : "medecin-generaliste"
                }
            }
        ]
    }
}

Deleted

Fields

Property Type Default Description
type String required Event type practitioner_deleted
timestamps Timestamps current timestamps When the event has been occurred
practitioner Object required Practitioner
  id Integer unsigned nullable Primary key
  uuid String required e.g: 72e449a8-78e1-4256-b8c8-b4c4b1eb3588
  email String required e.g: ech.chebaby@gmail.com
  firstname Object required e.g: {"fr": "Nour-Eddine", "ar": "نورالدين"}
  lastname Object required e.g: {"fr": "ECH-CHEBABY", "ar": "الشبابي"}
  slug String required Full name slugified e.g: nour-eddine-ech-chebaby
  password String required The practitioner password
  type String required "doctor" or "therapist"
  gender String required "m" or "f" (m: male, f: female)
  is_active Boolean false false or true
  verified_at DeteTime nullable when the practitioner verify his email
  confirmed_at DeteTime nullable when the admin confirms the practitioner's account
  certified_at DeteTime nullable when the admin verify practitioner's credentials
  mobile String nullable Preferably with a dial code e.g: "+212601548257"
  dial_code String nullable e.g: "+212"
  visits_count Integer unsigned 0 Profile visits counter
  phone_requests_count Integer unsigned 0 How many times practitioner phone number been requested
  reviews_count Integer unsigned 0 Reviews counter
  rating_average Float {8,2} nullable Rating average
  facebook String nullable URL
  twitter String nullable URL
  youtube String nullable URL
  description String nullable Description : Presentation of the clinic
  info String nullable Info : Access details
  credentials String nullable Credentials: Diploma and Training
  career String nullable Career
  specialities Array required Practitioner's specialities
  establishments Array required Establishments to which the practitioner belongs
  services Array required Practitioner's services
  motives Array required Practitioner's motives

JSON representation

{
    "type" : "practitioner_deleted",
    "timestamps" : "20180312092737",
    "practitioner" : {
        "id" : "{unsignedInteger}|null",
        "uuid" : "72e449a8-78e1-4256-b8c8-b4c4b1eb3588",
        "email" : "ech.chebaby@gmail.com",
        "firstname" : {
            "fr" : "Nour-Eddine",
            "ar" : "نورالدين"
        },
        "lastname" : {
            "fr" : "ECH-CHEBABY",
            "ar" : "الشبابي"
        },
        "slug" : "nour-eddine-ech-chebaby",
        "password" : "y$NdCa0P2cdEnBWaj56ewTqO/uiX.3TiF/tPbcC02We/KzSkpHAyvwa",
        "type" : "doctor|therapist",
        "gender" : "m|f",
        "is_active" : "true|false",
        "verified_at" : "{datetime}",
        "confirmed_at" : "{datetime}",
        "certified_at" : "{datetime}",
        "mobile" : "+212601548257",
        "dial_code" : "+212",
        "visits_count" : "{unsignedInteger}",
        "phone_requests_count" : "{unsignedInteger}",
        "reviews_count" : "{unsignedInteger}",
        "rating_average" : "{float}",
        "facebook" : "{url}",
        "twitter" : "{url}",
        "youtube" : "{url}",
        "description" : "{text}",
        "info" : "{text}",
        "credentials" : "{text}",
        "career" : "{text}",
        "created_at" : "{datetime}",
        "updated_at" : "{datetime}", 
        "specialties": [],
        "establishments" : [],
        "services" : [],
        "motives" : []
    }
}

Responses

success

{
    "status"  : "success",
    "code"    : 200,
    "message" : ""
}

errors

{
    "status"  : "error",
    "code"    : 404,
    "message" : "Data not found"
}
{
    "status"  : "error",
    "code"    : 412,
    "message" : "The signature is invalid."
}
{
    "status"  : "error",
    "code"    : 422,
    "message" : "The given data was invalid."
}

Error handling

sudo apt install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml php7.2-fpm libapache2-mod-php7.2 php7.2-imagick php7.2-recode php7.2-tidy php7.2-xmlrpc php7.2-intl status Description
200 - HTTP_OK Everything worked as expected.
404 - HTTP_NOT_FOUND The requested resource doesn't exist.
412 - HTTP_PRECONDITION_FAILED Failing to validate the signature.
422 - HTTP_UNPROCESSABLE_ENTITY Failing to validate fields (e.g., when a date is invalid).
500, 502, 503, 504 - Server Errors Something went wrong on Doctori's end. (These are rare.)