POST to a table that has a belongs_to relationship no longer working in 2.3


#1

Hello. Please help with this urgent matter.

I updated to df 2.3 . In 2.1 the current schema and system worked.

I have a table pictures. this table has a field user_id . the user_id has belongs_to relationship to the user_profile table.

name -> user_profile_by_user_id type -> belongs_to table-> user_profile field-> user_id

When I post data into the pictures table, I see I need to post data for the user_profile_by_user_id now. But I don’t have that data. I just want to get the user_profile for each picture when I query the pictures table.

[“message”]=>
string(77) “Failed to update belongs-to assignment.
No valid fields were found in record.”

This exact setup worked in 2.1. And now i’m stuck because POST does’nt work on any of the schema anymore.

Is there a param I can send stating I don’t want to update the user_profile table also?

please help @drewpearce

Thank you.


#2

What type of database?
Also, I’m having trouble understanding the structure of the relationship between the tables from your description. Can you do 2 GETs and post the results here
GET servicename/_schema/pictures
GET servicename/_schema/user_profile

Thanks


#3

This was got from the schema menu and clicking json. Because making a get call to schema/table_name gives me this error :

{
“error”: {
“context”: null,
“message”: “Unauthorized. User credentials did not match.”,
“code”: 401,
“trace”: [

I don’t want to sound ungratefull for the free tool that you provide but this last release seems to me full of errors. Things don’t behave the same like 2.1 in the ui. I’ve had to revert back to 2.1 after a broken update using git, and a clean install of the azure df image that I can’t make the whole logic work again.

Thank you.

pictures table :

{
“alias”: “pictures”,
“name”: “pictures”,
“is_view”: false,
“label”: “pictures”,
“plural”: “pictures”,
“description”: null,
“primary_key”: “id”,
“name_field”: null,
“field”: [
{
“alias”: “active”,
“name”: “active”,
“label”: “active”,
“description”: null,
“type”: “boolean”,
“db_type”: “tinyint(1)”,
“length”: 1,
“precision”: null,
“scale”: null,
“default”: true,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “created_at”,
“name”: “created_at”,
“label”: “created_at”,
“description”: null,
“type”: “datetime”,
“db_type”: “datetime”,
“length”: null,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “id”,
“name”: “id”,
“label”: “id”,
“description”: null,
“type”: “id”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: true,
“is_primary_key”: true,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “description”,
“name”: “description”,
“label”: “description”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(255)”,
“length”: 255,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “down_votes”,
“name”: “down_votes”,
“label”: “down_votes”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “image_path”,
“name”: “image_path”,
“label”: “image_path”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(255)”,
“length”: 255,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “pic_height”,
“name”: “pic_height”,
“label”: “pic_height”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “pic_width”,
“name”: “pic_width”,
“label”: “pic_width”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “points”,
“name”: “points”,
“label”: “points”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “points_multiplier”,
“name”: “points_multiplier”,
“label”: “points_multiplier”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “timezone”,
“name”: “timezone”,
“label”: “timezone”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(255)”,
“length”: 255,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “up_votes”,
“name”: “up_votes”,
“label”: “up_votes”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “user_id”,
“name”: “user_id”,
“label”: “user_id”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: true,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: true,
“is_virtual_foreign_key”: true,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: 7,
“ref_table”: “user_profile”,
“ref_fields”: “user_id”,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
}
],
“related”: [
{
“alias”: “user_id”,
“name”: “user_profile_by_user_id”,
“label”: “User Id”,
“description”: null,
“always_fetch”: true,
“flatten”: false,
“flatten_drop_prefix”: false,
“type”: “belongs_to”,
“field”: “user_id”,
“is_virtual”: true,
“is_foreign_service”: false,
“ref_service”: null,
“ref_service_id”: 7,
“ref_table”: “user_profile”,
“ref_fields”: “user_id”,
“ref_on_update”: null,
“ref_on_delete”: null,
“is_foreign_junction_service”: false,
“junction_service”: null,
“junction_service_id”: null,
“junction_table”: null,
“junction_field”: null,
“junction_ref_field”: null
}
],
“access”: 31
}

user_profile

{
“alias”: “user_profile”,
“name”: “user_profile”,
“is_view”: false,
“label”: “user_profile”,
“plural”: “user_profiles”,
“description”: null,
“primary_key”: “user_id”,
“name_field”: null,
“field”: [
{
“alias”: “user_id”,
“name”: “user_id”,
“label”: “user_id”,
“description”: null,
“type”: “id”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: true,
“is_primary_key”: true,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “description”,
“name”: “description”,
“label”: “description”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(255)”,
“length”: 255,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “down_votes”,
“name”: “down_votes”,
“label”: “down_votes”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “fans”,
“name”: “fans”,
“label”: “fans”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “idols”,
“name”: “idols”,
“label”: “idols”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “last_picture_time”,
“name”: “last_picture_time”,
“label”: “last_picture_time”,
“description”: null,
“type”: “datetime”,
“db_type”: “datetime”,
“length”: null,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “points”,
“name”: “points”,
“label”: “points”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “profile_picture”,
“name”: “profile_picture”,
“label”: “profile_picture”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(255)”,
“length”: 255,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “up_votes”,
“name”: “up_votes”,
“label”: “up_votes”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “user_name”,
“name”: “user_name”,
“label”: “user_name”,
“description”: null,
“type”: “string”,
“db_type”: “varchar(255)”,
“length”: 255,
“precision”: null,
“scale”: null,
“default”: null,
“required”: false,
“allow_null”: true,
“fixed_length”: false,
“supports_multibyte”: true,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
},
{
“alias”: “pictures”,
“name”: “pictures”,
“label”: “pictures”,
“description”: null,
“type”: “integer”,
“db_type”: “int(11)”,
“length”: 11,
“precision”: null,
“scale”: null,
“default”: 0,
“required”: false,
“allow_null”: false,
“fixed_length”: false,
“supports_multibyte”: false,
“auto_increment”: false,
“is_primary_key”: false,
“is_unique”: false,
“is_index”: false,
“is_foreign_key”: false,
“is_virtual_foreign_key”: false,
“is_foreign_ref_service”: false,
“ref_service”: null,
“ref_service_id”: null,
“ref_table”: null,
“ref_fields”: null,
“ref_on_update”: null,
“ref_on_delete”: null,
“picklist”: null,
“validation”: null,
“db_function”: null
}
],
“related”: [
{
“alias”: null,
“name”: “follow_relationship_by_follower_id”,
“label”: “Follow Relationship By Follower Id”,
“description”: null,
“always_fetch”: false,
“flatten”: false,
“flatten_drop_prefix”: false,
“type”: “has_many”,
“field”: “user_id”,
“is_virtual”: true,
“is_foreign_service”: false,
“ref_service”: null,
“ref_service_id”: 7,
“ref_table”: “follow_relationship”,
“ref_fields”: “follower_id”,
“ref_on_update”: null,
“ref_on_delete”: null,
“is_foreign_junction_service”: false,
“junction_service”: null,
“junction_service_id”: null,
“junction_table”: null,
“junction_field”: null,
“junction_ref_field”: null
},
{
“alias”: null,
“name”: “follow_relationship_by_following_id”,
“label”: “Follow Relationship By Following Id”,
“description”: null,
“always_fetch”: false,
“flatten”: false,
“flatten_drop_prefix”: false,
“type”: “has_many”,
“field”: “user_id”,
“is_virtual”: true,
“is_foreign_service”: false,
“ref_service”: null,
“ref_service_id”: 7,
“ref_table”: “follow_relationship”,
“ref_fields”: “following_id”,
“ref_on_update”: null,
“ref_on_delete”: null,
“is_foreign_junction_service”: false,
“junction_service”: null,
“junction_service_id”: null,
“junction_table”: null,
“junction_field”: null,
“junction_ref_field”: null
},
{
“alias”: null,
“name”: “pictures_by_user_id”,
“label”: “Pictures By User Id”,
“description”: null,
“always_fetch”: false,
“flatten”: false,
“flatten_drop_prefix”: false,
“type”: “has_many”,
“field”: “user_id”,
“is_virtual”: true,
“is_foreign_service”: false,
“ref_service”: null,
“ref_service_id”: 7,
“ref_table”: “pictures”,
“ref_fields”: “user_id”,
“ref_on_update”: null,
“ref_on_delete”: null,
“is_foreign_junction_service”: false,
“junction_service”: null,
“junction_service_id”: null,
“junction_table”: null,
“junction_field”: null,
“junction_ref_field”: null
}
],
“access”: 31
}


#4

Can you provide a sample payload. What exactly are you posting to the pictures table?