# How to call post api while connecting one to one relationship between two tables?

**URL:** https://community.dreamfactory.com/t/how-to-call-post-api-while-connecting-one-to-one-relationship-between-two-tables/2248
**Category:** REST API
**Created:** [February 23, 2016, 5:56am UTC](https://community.dreamfactory.com/t/how-to-call-post-api-while-connecting-one-to-one-relationship-between-two-tables/2248 "2016-02-23T05:56:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dreamfactorydev](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dreamfactorydev](https://community.dreamfactory.com/u/dreamfactorydev)
#### Post date: [February 23, 2016, 5:56am UTC](https://community.dreamfactory.com/t/how-to-call-post-api-while-connecting-one-to-one-relationship-between-two-tables/2248/1 "2016-02-23T05:56:56Z")

</div>

I have two tables with **one to one relationship** as following

![](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/1X/c6972d0492b54f891a26b9c544d799cacaab3993.png)

I need to call the api to create the record as following

```
api end-point : http://localhost:81/api/v2/treat_well/_table/tw_venue?related=tw_venue_contact

body:

{
  "resource": [
    {
      "name": "Rest Point",
      "type_id" : "1",
      "description":"The comfort place to take rest with our care.",
      "logo":"http://www.logo.png",
      "tw_venue_contact_by_venue_id":[
        {
              "longtitude":"6.87491200",
              "latitude" : "6.87491200",
              "address" : "Colombo-06",
              "city_id" : "1",
              "country_id" : "1",
              "phone" : "0112345678",
              "mobile" : "0771234567",
              "email" : "touch@relif.com",
              "website" : "http://relief.com",
              "twitter" : "http://google.com/releif",
              "google" : "http://google.com/releif",
              "added_date" : "2016-01-01",
              "user_id" : "26"

        }
        ]
      
    }
  ]
}

```

I’m getting error as following

> {  
> “error”: {  
> “context”: null,  
> “message”: “Failed to update many to one assignment.\nRelated record has no primary key value for ‘venue\_id’.”,  
> “code”: 400,

I’m trying to create the records by with having\*\* one to one relationship\*\* why do i get this error from DSP?

But when i try to create the records between **one to many relationship** tables it’s working fine.

What’s the mistake that i have been here? Please anyone explain to me @formerstaff @benbusse …
