# Creating a basic node with label using user defined procedure

**URL:** https://community.neo4j.com/t/creating-a-basic-node-with-label-using-user-defined-procedure/18102
**Category:** Procedures & APOC
**Tags:** procedure
**Created:** [May 5, 2020, 9:09am UTC](https://community.neo4j.com/t/creating-a-basic-node-with-label-using-user-defined-procedure/18102 "2020-05-05T09:09:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pankajpahuja1](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/pankajpahuja1/32/10935_2.png) [@pankajpahuja1](https://community.neo4j.com/u/pankajpahuja1)
#### Post date: [May 5, 2020, 9:09am UTC](https://community.neo4j.com/t/creating-a-basic-node-with-label-using-user-defined-procedure/18102/1 "2020-05-05T09:09:06Z")

</div>

The neo4j doc state that we can perform write operations on DB by User Defined Procedures using mode=mode.WRITE with this I have successfully implemented delete operation but for creating a node there is no sample document and I am finding it difficult to implement so is there any sample snippet for that?

---

<div class="post-metadata">

### Author: ![anthapu](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/anthapu/32/4113_2.png) [@anthapu](https://community.neo4j.com/u/anthapu)
#### Post date: [May 5, 2020, 12:29pm UTC](https://community.neo4j.com/t/creating-a-basic-node-with-label-using-user-defined-procedure/18102/2 "2020-05-05T12:29:27Z")

</div>

You can use createNode api.

```auto
public static final Label EVENT_NODE_LABEL = Label
        .label("Event");

Node eventNode = db.createNode(EVENT_NODE_LABEL);
                eventNode.setProperty("timestamp", timestamp);
                eventNode.setProperty("status", "NEW");

```

That's it.

---

<div class="post-metadata">

### Author: ![kaptenh](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/kaptenh/32/1171_2.png) [@kaptenh](https://community.neo4j.com/u/kaptenh)
#### Post date: [May 5, 2020, 12:46pm UTC](https://community.neo4j.com/t/creating-a-basic-node-with-label-using-user-defined-procedure/18102/3 "2020-05-05T12:46:53Z")

</div>

something like this creates a node and sets a propery called property to an int value:  
public class Insert {

```
@Context
public Transaction tx;                                                                                            

@Context
public Log log;                                                                                                   

@Procedure(name = "test.create", mode = Mode.WRITE)
@Description("CALL test.create(label, long_prop)")
public void create(@Name(value = "label") String label,
                                @Name(value = "prop") Long prop){
    Label l = Label.label(label);                                                                                 
    Node node = tx.createNode(l);                                                                                 
  	node.setProperty("property", prop);                                                                           
}

```

}
