Creating new customer from API doesn't set the Associations group id - web-services

I am trying to create a new customer using prestashop webservice on Postman. I already update webservice to accept json format for both input&output. When i try to create a new customer, there is a row added to database but the associations group id is not added.
I get the blank resource by http://mywebsite.com/api/customers?schema=synopsis and here what i get:
{
"customer": {
"id_default_group": "",
"id_lang": "",
"newsletter_date_add": "",
"ip_registration_newsletter": "",
"last_passwd_gen": "",
"secure_key": "",
"deleted": "",
"passwd": "",
"lastname": "",
"firstname": "",
"email": "",
"id_gender": "",
"birthday": "",
"newsletter": "",
"optin": "",
"website": "",
"company": "",
"siret": "",
"ape": "",
"outstanding_allow_amount": "",
"show_public_prices": "",
"id_risk": "",
"max_payment_days": "",
"active": "",
"note": "",
"is_guest": "",
"id_shop": "",
"id_shop_group": "",
"date_add": "",
"date_upd": "",
"reset_password_token": "",
"reset_password_validity": "",
"associations": {
"groups": [
{
"id": null
}
]
}
}
}
and here is how i fill out the form:
{
"customer": {
"id_default_group": "3",
"id_lang": "1",
"newsletter_date_add": "0000-00-00 00:00:00",
"ip_registration_newsletter": "",
"last_passwd_gen": "",
"secure_key": "",
"deleted": "0",
"passwd": "20101998",
"lastname": "sign up",
"firstname": "test",
"email": "asdfgh#gmail.com",
"id_gender": "2",
"birthday": "0000-00-00",
"newsletter": "0",
"optin": "0",
"website": "",
"company": "",
"siret": "",
"ape": "",
"outstanding_allow_amount": "0.000000",
"show_public_prices": "0",
"id_risk": "0",
"max_payment_days": "0",
"active": "1",
"note": "",
"is_guest": "0",
"id_shop": "1",
"id_shop_group": "1",
"date_add": "",
"date_upd": "",
"reset_password_token": "",
"reset_password_validity": "0000-00-00 00:00:00",
"associations": {
"groups": [
{
"id": "3"
}
]
}
}
}
and here is the result:
{
"customers": [
{
"id": "41",
"id_default_group": 3,
"id_lang": "1",
"newsletter_date_add": "0000-00-00 00:00:00",
"ip_registration_newsletter": "",
"last_passwd_gen": "2019-11-08 09:24:55",
"secure_key": "c8aa63435abbd3282b22080c903091e4",
"deleted": "0",
"passwd": "$2y$10$mt4u0xuPadIRVsV267Ao8uTGEPU.vixzNMRAfX5P.WY2OJClpBHsW",
"lastname": "sign up",
"firstname": "test",
"email": "asdfgh#gmail.com",
"id_gender": "2",
"birthday": "0000-00-00",
"newsletter": "0",
"optin": "0",
"website": "",
"company": "",
"siret": "",
"ape": "",
"outstanding_allow_amount": "0.000000",
"show_public_prices": "0",
"id_risk": "0",
"max_payment_days": "0",
"active": "1",
"note": "",
"is_guest": "0",
"id_shop": "1",
"id_shop_group": "1",
"date_add": "2019-11-08 15:24:55",
"date_upd": "2019-11-08 15:24:55",
"reset_password_token": "",
"reset_password_validity": "0000-00-00 00:00:00"
}
]
}
You can see that no association return.
Could anyone tell me what I was wrong? I'm quite new to prestashop. Thanks in advance

Related

How to add Multiple inputs in AWS Elastic transcoder CLI? [RE] [duplicate]

I am trying to stitch two clips with AWS Elastic Transcoder CLI, but I am getting error.
My command : aws elastictranscoder create-job --pipeline-id 158182938949-p2e73l --inputs Key=movie1.mp4,movie2.mp4 --outputs Key=complete-mov.mp4,PresetId=159474848914704-fupili,Watermarks=[{PresetWatermarkId=TopLeft,InputKey=Untitled-4png.png}]
I am getting this error :
Parameter validation failed:
Invalid type for parameter Inputs[0].Key, value: ['MEYD-001.mp4', 'intro.mp4'], type: <class 'list'>, valid types: <class 'str'>
How can I ADD Multiple inputs[videos] in AWS Elastic transcoder CLI ?
AWS docs is lacking this.
Best Regards.
#akamai - i was wrong. ET does allow you to stitch clips in a single operation. I think your issue is your using the shortcut syntax and not passing a JSON array.
Try updating your command from
Key=movie1.mp4,movie2.mp4
to
'[{"Key"="movie1.mp4"},{"Key"="movie2.mp4"}]'
You may need some additional parameters to get the desired result. You can use the AWS command to generate a template to guide you like this: aws elastictranscoder create-job --generate-cli-skeleton. That will output a JSON string with every available property of the command. If you look at the Inputs section below, its defined as an array: "Inputs": [.
myname#mypc:~$ aws elastictranscoder create-job --generate-cli-skeleton
{
"PipelineId": "",
"Input": {
"Key": "",
"FrameRate": "",
"Resolution": "",
"AspectRatio": "",
"Interlaced": "",
"Container": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"TimeSpan": {
"StartTime": "",
"Duration": ""
},
"InputCaptions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"DetectedProperties": {
"Width": 0,
"Height": 0,
"FrameRate": "",
"FileSize": 0,
"DurationMillis": 0
}
},
"Inputs": [
{
"Key": "",
"FrameRate": "",
"Resolution": "",
"AspectRatio": "",
"Interlaced": "",
"Container": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"TimeSpan": {
"StartTime": "",
"Duration": ""
},
"InputCaptions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"DetectedProperties": {
"Width": 0,
"Height": 0,
"FrameRate": "",
"FileSize": 0,
"DurationMillis": 0
}
}
],
"Output": {
"Key": "",
"ThumbnailPattern": "",
"ThumbnailEncryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"Rotate": "",
"PresetId": "",
"SegmentDuration": "",
"Watermarks": [
{
"PresetWatermarkId": "",
"InputKey": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"AlbumArt": {
"MergePolicy": "",
"Artwork": [
{
"InputKey": "",
"MaxWidth": "",
"MaxHeight": "",
"SizingPolicy": "",
"PaddingPolicy": "",
"AlbumArtFormat": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Composition": [
{
"TimeSpan": {
"StartTime": "",
"Duration": ""
}
}
],
"Captions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"CaptionFormats": [
{
"Format": "",
"Pattern": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
},
"Outputs": [
{
"Key": "",
"ThumbnailPattern": "",
"ThumbnailEncryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"Rotate": "",
"PresetId": "",
"SegmentDuration": "",
"Watermarks": [
{
"PresetWatermarkId": "",
"InputKey": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"AlbumArt": {
"MergePolicy": "",
"Artwork": [
{
"InputKey": "",
"MaxWidth": "",
"MaxHeight": "",
"SizingPolicy": "",
"PaddingPolicy": "",
"AlbumArtFormat": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Composition": [
{
"TimeSpan": {
"StartTime": "",
"Duration": ""
}
}
],
"Captions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"CaptionFormats": [
{
"Format": "",
"Pattern": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"OutputKeyPrefix": "",
"Playlists": [
{
"Name": "",
"Format": "",
"OutputKeys": [
""
],
"HlsContentProtection": {
"Method": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": "",
"LicenseAcquisitionUrl": "",
"KeyStoragePolicy": ""
},
"PlayReadyDrm": {
"Format": "",
"Key": "",
"KeyMd5": "",
"KeyId": "",
"InitializationVector": "",
"LicenseAcquisitionUrl": ""
}
}
],
"UserMetadata": {
"KeyName": ""
}
}

How to add Multiple inputs in AWS Elastic transcoder CLI?

I am trying to stitch two clips with AWS Elastic Transcoder CLI, but I am getting error.
My command : aws elastictranscoder create-job --pipeline-id 158182938949-p2e73l --inputs Key=movie1.mp4,movie2.mp4 --outputs Key=complete-mov.mp4,PresetId=159474848914704-fupili,Watermarks=[{PresetWatermarkId=TopLeft,InputKey=Untitled-4png.png}]
I am getting this error :
Parameter validation failed:
Invalid type for parameter Inputs[0].Key, value: ['MEYD-001.mp4', 'intro.mp4'], type: <class 'list'>, valid types: <class 'str'>
How can I ADD Multiple inputs[videos] in AWS Elastic transcoder CLI ?
AWS docs is lacking this.
Best Regards.
#akamai - i was wrong. ET does allow you to stitch clips in a single operation. I think your issue is your using the shortcut syntax and not passing a JSON array.
Try updating your command from
Key=movie1.mp4,movie2.mp4
to
'[{"Key"="movie1.mp4"},{"Key"="movie2.mp4"}]'
You may need some additional parameters to get the desired result. You can use the AWS command to generate a template to guide you like this: aws elastictranscoder create-job --generate-cli-skeleton. That will output a JSON string with every available property of the command. If you look at the Inputs section below, its defined as an array: "Inputs": [.
myname#mypc:~$ aws elastictranscoder create-job --generate-cli-skeleton
{
"PipelineId": "",
"Input": {
"Key": "",
"FrameRate": "",
"Resolution": "",
"AspectRatio": "",
"Interlaced": "",
"Container": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"TimeSpan": {
"StartTime": "",
"Duration": ""
},
"InputCaptions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"DetectedProperties": {
"Width": 0,
"Height": 0,
"FrameRate": "",
"FileSize": 0,
"DurationMillis": 0
}
},
"Inputs": [
{
"Key": "",
"FrameRate": "",
"Resolution": "",
"AspectRatio": "",
"Interlaced": "",
"Container": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"TimeSpan": {
"StartTime": "",
"Duration": ""
},
"InputCaptions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"DetectedProperties": {
"Width": 0,
"Height": 0,
"FrameRate": "",
"FileSize": 0,
"DurationMillis": 0
}
}
],
"Output": {
"Key": "",
"ThumbnailPattern": "",
"ThumbnailEncryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"Rotate": "",
"PresetId": "",
"SegmentDuration": "",
"Watermarks": [
{
"PresetWatermarkId": "",
"InputKey": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"AlbumArt": {
"MergePolicy": "",
"Artwork": [
{
"InputKey": "",
"MaxWidth": "",
"MaxHeight": "",
"SizingPolicy": "",
"PaddingPolicy": "",
"AlbumArtFormat": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Composition": [
{
"TimeSpan": {
"StartTime": "",
"Duration": ""
}
}
],
"Captions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"CaptionFormats": [
{
"Format": "",
"Pattern": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
},
"Outputs": [
{
"Key": "",
"ThumbnailPattern": "",
"ThumbnailEncryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
},
"Rotate": "",
"PresetId": "",
"SegmentDuration": "",
"Watermarks": [
{
"PresetWatermarkId": "",
"InputKey": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"AlbumArt": {
"MergePolicy": "",
"Artwork": [
{
"InputKey": "",
"MaxWidth": "",
"MaxHeight": "",
"SizingPolicy": "",
"PaddingPolicy": "",
"AlbumArtFormat": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Composition": [
{
"TimeSpan": {
"StartTime": "",
"Duration": ""
}
}
],
"Captions": {
"MergePolicy": "",
"CaptionSources": [
{
"Key": "",
"Language": "",
"TimeOffset": "",
"Label": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"CaptionFormats": [
{
"Format": "",
"Pattern": "",
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
]
},
"Encryption": {
"Mode": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": ""
}
}
],
"OutputKeyPrefix": "",
"Playlists": [
{
"Name": "",
"Format": "",
"OutputKeys": [
""
],
"HlsContentProtection": {
"Method": "",
"Key": "",
"KeyMd5": "",
"InitializationVector": "",
"LicenseAcquisitionUrl": "",
"KeyStoragePolicy": ""
},
"PlayReadyDrm": {
"Format": "",
"Key": "",
"KeyMd5": "",
"KeyId": "",
"InitializationVector": "",
"LicenseAcquisitionUrl": ""
}
}
],
"UserMetadata": {
"KeyName": ""
}
}

Querying data on S3 Object

Trying to query data on json file using S3-Select
{
"groups_id":
{
"307225":
{
"created_at": "2015-02-10T17:24:15-08:00",
"updated_at": "2017-09-06T17:25:22-07:00",
"name": "Company 1",
"company": true,
"contact_name": "User 1",
"email": "",
"phone_number": "",
"address": "",
"website": "",
"notes": "Testing",
"id": "307225"
},
"1058565":
{
"created_at": "2017-04-02T23:44:10-07:00",
"updated_at": "2017-07-18T17:39:21-07:00",
"name": "Company 3",
"company": true,
"contact_name": "User 1",
"email": "",
"phone_number": "",
"address": "",
"website": "",
"notes": null,
"id": "1058565"
}
}
}
Can someone help to get the desired output using s3 select, based on the condition as WHERE contact_name='User 1'.
{"id": "307225", "name": "Company 1"},
{"id": "1058565","name": "Company 3"}
below are the queries we had tried,
Select s.groups_id['307225'].id from s3object s
Select s.groups_id['1058565'].id from s3object s
in the above queries, we had hardcoded the group_id and we are able to fetch below
{
"id": "1058565"
}
but in our case groupid is dynamic so i am not understanding. how to handle that?

Ember Serialize 'ID'

I'm making an API call in Ember and the API I'm hitting is returning some JSON with 'ID' capitalized, it seems Ember is looking for lowercase 'id.' Everything else should work, so how would I serialize just this one piece of JSON in this instance?
See JSON below.
{
"ID": 2,
"name": "Main Menu",
"slug": "main-menu",
"description": "",
"count": 4,
"items": [
{
"id": 11,
"order": 1,
"parent": 0,
"title": "Contact",
"url": "http://localhost:8888/contact/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 7,
"object": "page",
"object_slug": "contact",
"type": "post_type",
"type_label": "Page"
},
{
"id": 12,
"order": 2,
"parent": 0,
"title": "About",
"url": "http://localhost:8888/about/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 5,
"object": "page",
"object_slug": "about",
"type": "post_type",
"type_label": "Page",
"children": [
{
"id": 21,
"order": 3,
"parent": 12,
"title": "About Us – Sub",
"url": "http://localhost:8888/about/about-us-sub/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 9,
"object": "page",
"object_slug": "about-us-sub",
"type": "post_type",
"type_label": "Page"
}
]
},
{
"id": 13,
"order": 4,
"parent": 0,
"title": "Home",
"url": "http://localhost:8888/home/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 2,
"object": "page",
"object_slug": "home",
"type": "post_type",
"type_label": "Page"
}
],
"meta": {
"links": {
"collection": "http://localhost:8888/wp-json/wp/v2/menus/",
"self": "http://localhost:8888/wp-json/wp/v2/menus/2"
}
}
}
You can define primaryKey: 'ID' by creating model specific serializer. read more for info https://guides.emberjs.com/v2.13.0/models/customizing-serializers/#toc_ids

Ember Array Iteration

I'm getting my JSON in my model and rendering it fine on the template, however, I'd like to access this array (items) on my template. The goal here is to dynamically render these menu items in the nav bar.
My handlebars looks like this,
{{#each menus as |menu|}}
{{#each menu.items as |items|}}
{{items}}
{{/each}}
{{/each}}
And returns
[object Object] [object Object] [object Object]
Any ideas?
JSON below.
{
"ID": 2,
"name": "Main Menu",
"slug": "main-menu",
"description": "",
"count": 4,
"items": [
{
"id": 11,
"order": 1,
"parent": 0,
"title": "Contact",
"url": "http://localhost:8888/contact/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 7,
"object": "page",
"object_slug": "contact",
"type": "post_type",
"type_label": "Page"
},
{
"id": 12,
"order": 2,
"parent": 0,
"title": "About",
"url": "http://localhost:8888/about/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 5,
"object": "page",
"object_slug": "about",
"type": "post_type",
"type_label": "Page",
"children": [
{
"id": 21,
"order": 3,
"parent": 12,
"title": "About Us – Sub",
"url": "http://localhost:8888/about/about-us-sub/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 9,
"object": "page",
"object_slug": "about-us-sub",
"type": "post_type",
"type_label": "Page"
}
]
},
{
"id": 13,
"order": 4,
"parent": 0,
"title": "Home",
"url": "http://localhost:8888/home/",
"attr": "",
"target": "",
"classes": "",
"xfn": "",
"description": "",
"object_id": 2,
"object": "page",
"object_slug": "home",
"type": "post_type",
"type_label": "Page"
}
],
"meta": {
"links": {
"collection": "http://localhost:8888/wp-json/wp/v2/menus/",
"self": "http://localhost:8888/wp-json/wp/v2/menus/2"
}
}
}