Akeneo PIM - add media to product validation - rest

we are trying to add media to a product from a REST call, and facing an error.
{
"code": 422,
"message": "Validation failed.",
"errors": [
{
"property": "attribute",
"message": "Cannot set the property \"banner_image\" to this entity as it is not in the attribute set"
}
]
}
API ENDPOINT: {{url}}/api/rest/v1/media-files
form-data:
product -> {"identifier":"1273192971", "attribute":"banner_image", "scope": null,"locale":null, "data":null}
file -> testfile.jpg
If anyone can help, how to properly enter the attribute in JSON?
Regards,
Bassam
we are facing error:

as you can see you need your attribute banner_image to be added to your family before you try submit the request.
Go to Settings -> Families -> Select all from checkbox and hit bulk actions.
Select set attributes requirements then click on add attribute to add your banner_image attribute and save.
After that your request should work.

Related

How to pass owner attribute when creating user story using Rally API?

I am trying to pass the owner attribute to create a user story in rally using rally API But I am encountering below error.
{
"CreateResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": [
"Cannot parse object reference from \"{\"Owner\": {\"_refObjectName\": \"Ron\"}}\""
],
"Warnings": [
"Ignored JSON element HierarchicalRequirement.PortfolioItem during the processing of this request."
]
}
}
My request payload
{
"HierarchicalRequirement":{
"Name": "hello Wrold",
"Description":" 123 test description",
"Workspace": "/workspace/18686460234",
"Project":"/project/1025697468602323",
"PortfolioItem":"",
"Owner":{"_refObjectName":"Ron"},
"ScheduleState":"Defined"
}
}
Any thoughts?
In general, when referring to an object property that itself is an object (as in this case with the User object), you pass in the actual value of _ref, not another object. If you have previously been passed the reference to the user as a full blown URI, then you can still pass that in and the SDK will convert it to a _ref.
If you go to the webservice docs (https://rally1.rallydev.com/slm/doc/webservice/) for your subscription and go down to the User section, you can get the docs to fetch you some examples of users. The _ref will come back something like:
https://rally1.rallydev.com/slm/webservice/v2.0/user/39776836851
I believe that you can either use that, or just truncate it to the number at the end. So the code will need to be changed so that the Owner line reads:
"Owner" : "https://rally1.rallydev.com/slm/webservice/v2.0/user/39776836851"

SuiteCrm Rest API: JSON Body attributes throws error when calling POST or PUT

I'm using postman in order to call SuiteCRM REST API.
I tried to call this endpoint
PATCH http://{{suitecrm-url}}/Api/V8/module
and i've added this payload to the body (Content-Type: Application/Json):
{
"data": {
"type": "Accounts",
"id": "3a3ae651-d509-2508-7dc4-5be2e51cc96b",
"attributes": {
"name": "name with space"
}
}
}
When the request is executed SuiteCRM gives this response:
{
"errors": {
"status": 400,
"title": null,
"detail": "The option \"attributes\" with value array is invalid."
}
}
I found out that the problem was the whitespace in the value: when i tried to use the value "namewithspace", it worked.
Anyone has any idea how to solve this problem ?
Thanks in advance
I found out this issue on github that resolved my problem:
https://github.com/salesagility/SuiteCRM/issues/6452
In short to make it work i had to modify the file in
/Api/V8/Params/Options/Fields.php
and replace this line
const REGEX_FIELD_PATTERN = '/[^\w-,]/';
with
const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';
The person mentioned in github:
this is just for temporary fix and not upgrade safe

Rest API - Sharepoint 2016 - odata.metadata=minimal don´t work

If I make a GET request in Sharepoint 2016 Rest API using header accept "application/json;odata.metadata=minimal" in url /_api/web/lists/GetByTitle('Pages')/Fields, and library pages (o other list or library) has a Taxonomy Fields return error.
{
"odata.error": {
"code": "-2147467261, System.ArgumentNullException",
"message": {
"lang": "es-ES",
"value": "Value cannot be null.\r\nParameter name: type"
}
}
if remove Taxonomy Fields, it works perfectly.
if i make the request using accept "application/json;odata=verbose" with a Taxonomy Fields works perfectly too.
Summary:
If i have taxonomy fields odata.metadata=minimal don't work
Best Regards

Nested Rest resource throws constraint violation in Jhipster

I have a nested resource like this:
#GetMapping("/tour-requests/{tourRequestId}/tour-request-messages")
#Secured({AuthoritiesConstants.ADMIN})
public ResponseEntity<List<TourRequestMessageDTO>> getTourRequestMessagesForTourRequest(
#PathVariable("tourRequestId") long tourRequestId,
TourRequestMessageCriteria criteria) {
...
}
When I call this resource, for example with GET api/tour-requests/1301/tour-request-messages I get unexpected error:
{
"type": "https://zalando.github.io/problem/constraint-violation",
"title": "Constraint Violation",
"status": 400,
"path": "/api/tour-requests/1301/tour-request-messages",
"violations": [
{
"field": "tourRequestId",
"message": "Failed to convert property value of type 'java.lang.String' to required type 'io.github.jhipster.service.filter.LongFilter' for property 'tourRequestId'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'io.github.jhipster.service.filter.LongFilter' for property 'tourRequestId': no matching editors or conversion strategy found"
}
],
"message": "error.validation"
}
I tried to debug this, it seems that the exception is happening before the method is called-
The problem is that the search criteria has hijacked the path parameter tourRequestId, as it happen to be also a possible search parameter of the generated QueryService.
That it is why it tried to convert the tourRequestId parameter to LongFilter.
Renaming the path variable to ìd` did also not helped, but after renaming it to something different, the problem disappeared.
I've also hit this problem, but my choice was to remove the field from child's pt.up.hs.project.service.dto.ChildCriteria. When the resource is always nested, it just does not make sense to allow querying by the field which is also specified in the path.

Eloqua - Extract LastModifiedBy details of Security Group using REST API

I am trying to retrive security group details (last modified by field) using REST API,but unable to extract this information.
Here is my GET -
GET /Api/rest/2.0/system/security/groups?depth=partial&search=acronym%3DRXCM&xsrfToken=dfa16605-d884-4ebc-9a7b-16fd36c9181a
Response
{
"elements":
[
{
"type":"SecurityGroup",
"id":"29",
"createdAt":"1427641487",
"createdBy":"13",
"depth":"partial",
"name":"Central Marketing User",
"updatedAt":"1427641487",
"acronym":"RXCM",
"isEffective":"false",
"isReadOnly":"false"
}
],
"page":1,
"pageSize":1000,
"total":1
}
Does anyone knows how to get LastModifiedBy field?
You'll get more data on the response if you use the depth=complete instead of partial.
I'm not sure if that will return the LastModifiedBy.