A method for data transmission in a terminal device, comprising: determining a desired resource for transmitting a message 3 of a random access procedure according to a capability of the terminal device with respect to multiple-slot scheduling capability or schedulable bandwidth capability, and the size of the message 3, wherein the desired resource is: a number of slots, the number of slots is determined according to the size of the message 3 and the multiple-slot scheduling capability supported by the terminal device, where the multiple-slot scheduling capability is that the terminal device is able to be scheduled with multiple slots for data transmission; or a number of physical resource blocks, PRBs, the number of PRBs is determined according to the size of the message 3 and the schedulable bandwidth capability supported by the terminal device, where the schedulable bandwidth capability is that the terminal device is able to support data transmission or receiving using the allocated PRBs within the schedulable bandwidth; and transmitting a request for the desired resource to a network device via a message 1, of the random access procedure, transmission, for the network device to allocate resource for transmitting the message 3 according to the request for the desired resource. determining a desired resource for transmitting a message 3 of a random access procedure according to a capability of the terminal device with respect to multiple-slot scheduling capability or schedulable bandwidth capability, and the size of the message 3, wherein the desired resource is: a number of slots, the number of slots is determined according to the size of the message 3 and the multiple-slot scheduling capability supported by the terminal device, where the multiple-slot scheduling capability is that the terminal device is able to be scheduled with multiple slots for data transmission; or a number of physical resource blocks, PRBs, the number of PRBs is determined according to the size of the message 3 and the schedulable bandwidth capability supported by the terminal device, where the schedulable bandwidth capability is that the terminal device is able to support data transmission or receiving using the allocated PRBs within the schedulable bandwidth; and a number of slots, the number of slots is determined according to the size of the message 3 and the multiple-slot scheduling capability supported by the terminal device, where the multiple-slot scheduling capability is that the terminal device is able to be scheduled with multiple slots for data transmission; or a number of physical resource blocks, PRBs, the number of PRBs is determined according to the size of the message 3 and the schedulable bandwidth capability supported by the terminal device, where the schedulable bandwidth capability is that the terminal device is able to support data transmission or receiving using the allocated PRBs within the schedulable bandwidth; and transmitting a request for the desired resource to a network device via a message 1, of the random access procedure, transmission, for the network device to allocate resource for transmitting the message 3 according to the request for the desired resource.