> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mileapp.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Update data type by ID



## OpenAPI

````yaml /openapi/public/openapi-data.json put /data-type/{dataTypeId}
openapi: 3.0.0
info:
  title: MileApp API - Data
  version: 3.0.0
  description: MileApp API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Data Source
    description: >-
      The Data source could help you simplify the process of filling in task
      information based on existing data at MileApp. This data could consist of
      information such as name, number, date, coordinate, and multiple options.
      The Data typically represents entities such as customers, products,
      employees, suppliers, or any other critical data elements that are used
      across the application.


      **To see the details of data source object, please follow [this
      link](#tag/data_source_model)**
  - name: Data Type
    description: >-
      The Data type is the structure of data fields that is customizable to suit
      your business needs. Data type attributes consist of IDs, name, field
      details, type, and primary key. This data type structure will be used at
      Data Source and Flow.


      **To see the details of data type object, please follow [this
      link](#tag/data_type_model)**
paths:
  /data-type/{dataTypeId}:
    put:
      tags:
        - Data Type
      summary: Update data type by ID
      operationId: putDataTypeById
      parameters:
        - name: _id
          in: path
          required: true
          description: |-
            Unique identifier for the data that generated by system.
            **Example**: `640a45dd089dc95a0a09ef14`
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putRequestDataType'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                title: NetworkPutResponse
                properties:
                  status:
                    type: boolean
                    description: Status of response.
                  message:
                    description: Message of API response.
                    type: string
                  data_type:
                    description: Detail of object data type.
                    type: object
                    additionalProperties: true
                example:
                  status: true
                  message: Success
                  data_type:
                    _id: 640a45dd089dc95a0a09ef14
                    name: OutletDetail
                    fields:
                      - id: dataId
                        title: Data ID
                        type: string
                        default: 'true'
                        optionData: []
                        required: true
                      - id: outletName
                        title: Outlet Name
                        type: string
                        optionData: []
                        required: true
                      - id: outletHours
                        title: Outlet Hours
                        default: 12
                        type: number
                        optionData: []
                        required: true
                      - id: outletType
                        title: Outlet Type
                        type: string
                        optionData:
                          - minimarket
                          - supermarket
                          - vending machine
                          - warung
                        required: true
                      - id: outletOpen
                        title: Outlet Open
                        default: '09:00'
                        type: string
                        optionData: []
                        required: true
                      - id: outletClosed
                        title: Outlet Closed
                        default: '17:00'
                        type: string
                        optionData: []
                        required: true
                      - id: outletContractExpired
                        title: Outlet Contract Expired
                        type: string
                        optionData: []
                        required: true
                      - id: outletOpenInWeekend
                        title: Outlet Open In Weekend
                        type: string
                        optionData: []
                        required: true
                      - id: outletCoordinate
                        title: Outlet Coordinate
                        description: >-
                          Contoh inputan 
                          "-6.171702325136309,106.81775093078615"
                        type: string
                        optionData: []
                        required: true
                      - id: outletPhoneNumber
                        title: Outlet Phone Number
                        description: >-
                          Example format  "+628 456 7890 or +62 123 456 789 or
                          0123456789"
                        type: string
                        optionData: []
                        required: true
                      - id: outletCloseOrder
                        title: Outlet Close Order
                        description: >-
                          Example format  "2024-11-01 15:30:45 or
                          2024-11-01T15:30:45.123+02:00 or
                          2024-11-01T15:30:45+02:00"
                        type: string
                        format: date-time
                        optionData: []
                        required: true
                    createdBy: john.doe@mile.app
                    organizationId: 63c61d865347e356d05e3052
                    updatedTime: '2023-03-09 20:47:24'
                    createdTime: '2023-03-09 20:47:24'
                    provider: internal
                    providerConfig: null
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Bad request - invalid parameters provided.
        '404':
          description: Data not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Data not found
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  schemas:
    putRequestDataType:
      title: putRequestDataType
      example:
        name: OutletDetail
        fields:
          - id: dataId
            title: Data ID
            type: string
            optionData: []
            required: true
            primaryKey: true
          - id: outletName
            title: Outlet Name
            type: string
            optionData: []
            required: true
          - id: outletHours
            title: Outlet Hours
            default: 12
            type: number
            optionData: []
            required: true
          - id: outletType
            title: Outlet Type
            type: string
            optionData:
              - minimarket
              - supermarket
              - vending machine
              - warung
            required: true
          - id: outletOpen
            title: Outlet Open
            default: '09:00'
            type: string
            optionData: []
            required: true
          - id: outletClosed
            title: Outlet Closed
            default: '17:00'
            type: string
            optionData: []
            required: true
          - id: outletContractExpired
            title: Outlet Contract Expired
            type: string
            optionData: []
            required: true
          - id: outletOpenInWeekend
            title: Outlet Open In Weekend
            type: boolean
            optionData: []
            required: true
          - id: outletGeolocation
            title: Outlet Geolocation
            description: Contoh inputan  "-6.171702325136309,106.81775093078615"
            type: string
            optionData: []
            required: true
          - id: outletPhoneNumber
            title: Outlet Phone Number
            description: Example format  "+628 456 7890 or +62 123 456 789 or 0123456789"
            type: string
            optionData: []
            required: true
          - id: outletCloseOrder
            title: Outlet Close Order
            description: >-
              Example format  "2024-11-01 15:30:45 or
              2024-11-01T15:30:45.123+02:00 or 2024-11-01T15:30:45+02:00"
            type: string
            format: date-time
            optionData: []
            required: true
      type: object
      properties:
        name:
          type: string
          description: |-
            Name of data type.
            **Example**: `OutletDetail`
        fields:
          type: array
          description: |-
            List of fields to data type .
            **Example**: 
             `{` 
             `'id': 'dataId',` 
             `'title': 'Data ID',` 
             `'type': 'text',` 
             `'optionData': [],` 
             `'required': true,` 
             `'primaryKey': true` 
             `}`
          items:
            type: object
            properties:
              id:
                type: string
                description: |-
                  ID of Field.
                  **Example**: `outletName`
              title:
                type: string
                description: |-
                  Title of field.
                  **Example**: `Outlet Name`
              description:
                type: string
              inputType:
                type: string
                description: >-
                  The input type of the component (e.g., string, number, date,
                  etc.)
              default:
                type: string
                description: |-
                  Default value of field.
                  **Example**: `09:00:00 AM`
              optionData:
                type: array
                description: >-
                  Option Data of field. Field only exist, if *type* is
                  **option** 

                  **Example**: `['minimarket','supermarket','vending
                  machine','warung']`
                items:
                  type: string
              isRequired:
                type: boolean
                description: |2-
                   Flag that mark field as required or not.
                  **Example**: `true`
            required:
              - id
              - title
              - type
              - required
        deleteFields:
          type: array
          description: >-
            This parameter is list of fields to data type id for delete the
            field on collection of data source.

            **Example**: 
             `[` 
             `'outletPhoneNumber',` 
             `'outletCloseOrder'` 
             `]`
        limitUser:
          type: boolean
          description: |-
            Setting to limit data source usage by users.
            **Default**: `false`
        provider:
          type: string
          enum:
            - internal
            - external-api
          description: The data source provider type. Cannot be changed after creation.
        providerConfig:
          type: object
          nullable: true
          description: >-
            Provider-specific configuration. Can only be modified if the data
            type was created with `provider` set to `external-api`. The
            `provider` field itself cannot be changed after creation.
          oneOf:
            - description: For internal provider
              nullable: true
            - type: object
              description: For external-api provider
              properties:
                url:
                  type: string
                  format: uri
                  description: >-
                    The external API endpoint URL. Must be a valid [GET] URL
                    format.

                    **Example**: `https://api.external-system.com/v1/products`

                    **Validation**: Must be a valid [GET] URL with http:// or
                    https:// protocol
                key:
                  type: string
                  description: >-
                    Authentication key for the external API. When updating, if
                    not provided, the existing key will be preserved.

                    **Example**: `Bearer sk_live_1234567890`
              required:
                - url
      required:
        - name
        - fields
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````