Skip to content

Instantly share code, notes, and snippets.

@hndr91
Last active October 25, 2015 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hndr91/ffb5becaf99dddbb2ad9 to your computer and use it in GitHub Desktop.
Save hndr91/ffb5becaf99dddbb2ad9 to your computer and use it in GitHub Desktop.
Pati Directory Listing API

TYPE

/type

REST request for service type. Provides method for finding, creating, modifiying service type.

Method

  • POST

    Create new service type

    • acceptable request format: application/x-www-form-urlencoded

    • acceptable request params:

      param type
      typeName string
    • response:

      Code: 201

      key value
      error false
      message Service type successfully added
      value typeName

      OR

      Code: 200

      key value
      error true
      message Ooops ! Failed to add service type!
      value typeName

      OR

      Code: 200

      key value
      error true
      message Service type already existed
      value typeName
  • PUT

    Modify service type

    • acceptable request format: application/x-www-form-urlencoded

    • acceptable param:

      param type
      oldTypeName string
      newTypeName string
    • response:

      Code: 201

      key value
      error false
      message Service type updated

      OR

      Code: 200

      key value
      error true
      message Service type update failed

      OR

      Code: 200

      key value
      error true
      message Service type not exist
  • GET

    Returns all service type name in list

    • Response:

      Code: 200
      Content: { "type_name" : "rumah sakit" }


District

/district

REST request for service district. Provides method for finding district.

Method

  • GET

    Returns all district names

    • response:

      Code: 200
      Content: { "district_name" : "sukolilo" }


Service

/services

REST request for service. Provides method for finding, and creating service.

Method

  • POST

    • accepatable request format: application/x-www-form-urlencoded

    • acceptable param:

      param value
      serviceName string
      serviceAddress string
      serviceTelp string
      serviceEmail string
      serviceType string (id type)
      serviceDistrict string (id district)
      serviceInfo string
      serviceLocationName string
      serviceLocationLong string
      serviceLocationLat string
    • response:

      Code: 201

      key value
      error false
      message Service successfully added

      OR

      Code: 200

      key value
      error true
      message Ooops ! Failed to add service!

      OR

      Code: 200

      key value
      error true
      message Service already existed
  • GET

    Returns all services

    • response

      • Code: 200

      • Content:

        {
        "service_name" : "RSUD xxxx",
        "service_address" : "Jl. xxxxx no xxx",
        "service_telp" : "0295-111111",
        "service_email : "email@email.com",
        "service_type" : "1",
        "service_district" : "4",
        "service_info" : "BPJS Accepted",
        "service_img_ur" : "http://url.domain/img.jpg",
        "service_location_name" : "dekat xxx",
        "service_location_long" : "1.xxxx",
        "service_location_lat" : "100.xxxx"
        }


/services/:servicename

REST request for modifiying service using url paramater

Method

  • PUT

    • URL PARAM: old service name

    • acceptable request format: application/x-wwww-form-urlencoded

    • acceptable param:

      param value
      serviceName string
      serviceAddress string
      serviceTelp string
      serviceEmail string
      serviceType string (id type)
      serviceDistrict string (id district)
      serviceInfo string
      serviceLocationName string
      serviceLocationLong string
      serviceLocationLat string
    • response:

      Code: 201

      key value
      error false
      message Service updated

      OR

      Code: 200

      key value
      error true
      message Service update failed

      OR

      Code: 200

      key value
      error true
      message Service not exist

/services/type/:type

Returns all service with specific type

Method

  • GET

    • URL PARAM: service type id

    • response:

      • Code: 200

      • Content:

        {
        "service_name" : "RSUD xxxx",
        "service_address" : "Jl. xxxxx no xxx",
        "service_telp" : "0295-111111",
        "service_email : "email@email.com",
        "service_type" : "1",
        "service_district" : "4",
        "service_info" : "BPJS Accepted",
        "service_img_ur" : "http://url.domain/img.jpg",
        "service_location_name" : "dekat xxx",
        "service_location_long" : "1.xxxx",
        "service_location_lat" : "100.xxxx"
        }


/services/district/:district

Returns all service based on their district

Method

  • GET

    • URL Param: service district id

    • response:

      • Code: 200

      • Content:

        {
        "service_name" : "RSUD xxxx",
        "service_address" : "Jl. xxxxx no xxx",
        "service_telp" : "0295-111111",
        "service_email : "email@email.com",
        "service_type" : "1",
        "service_district" : "4",
        "service_info" : "BPJS Accepted",
        "service_img_ur" : "http://url.domain/img.jpg",
        "service_location_name" : "dekat xxx",
        "service_location_long" : "1.xxxx",
        "service_location_lat" : "100.xxxx"
        }


/services/target/:district/:type

Returns all service based on their district and their type

Method

  • GET

    • URL PARAM:

      param value
      district service district id (int)
      type service type id (int)
    • response:

      • Code: 200

      • Content:

        {
        "service_name" : "RSUD xxxx",
        "service_address" : "Jl. xxxxx no xxx",
        "service_telp" : "0295-111111",
        "service_email : "email@email.com",
        "service_type" : "1",
        "service_district" : "4",
        "service_info" : "BPJS Accepted",
        "service_img_ur" : "http://url.domain/img.jpg",
        "service_location_name" : "dekat xxx",
        "service_location_long" : "1.xxxx",
        "service_location_lat" : "100.xxxx"
        }


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment