As Internet of Things (IoT) is widely spread and is becoming heterogeneous, a growing number of connected devices are the focus of security threats. Hence, a standardized security strategy seems required. OneM2M [1] is a global standard initiative designed to satisfy the need for a common horizontal platform for the multi-industry M2M/IoT applications. In this paper, we propose an Intrusion Detection and Prevention System (IDPS), for the Service Layer introduced by the oneM2M standard. To our knowledge, it is the first generic IDPS for the oneM2M Service Layer based on Edge Machine Leaning (ML). We will detail, in this work, the strategy of the oneM2M-IDPS. Moreover, we investigate the performance of ML algorithms on the oneM2M generated dataset to choose the best ones for our IDPS. Since we are in the context of tiny devices (IoT), we pay attention in our experiments to the features dimension reduction in ML and thus, to the size of trained models.