Http with Azure AD - Graph API - POST Method - Powerapps - rest

I'm not able to send a POST or PATCH action thru the connector because I can't figure out how to compose the body correctly.
I try it that way:
But I get this error:
I try it without brakets, with more brakets, with single, double and without quotations but it seems nothing works.
Please can anyone tell me how to compose the body in the right way?
Thx!

Look like the body is not a valid json. Properties givenName, surname, etc. should be wrapped by quotes.
{
"givenName": "Microsoft",
"surname": "Graph",
"emailAddresses": [
{
"address": "Microsoft.graph#api.com",
"name": "Microsoft Graph"
}
],
"businessPhones": [
"+334100100"
],
"mobilePhone": "+9857665765"
}

Related

REST API, POST Rich Text Item to Domino server

i am trying to use the REST-API of my domino lotus notes server (9.0.1FP8)
It works for simple text-fields but if I try to add an rich-text-item as json, the domino server receives only the text-fields and the richt-text field is empty.
I try it with Postman and a Postrequest to http://localhost/Test/JSON_Vie…s/name/List?form=mainForm,
where I send the json
{
"title":"test rich text",
"artist":"rich texter",
"ntracks":1,
"attachments": {
"type": "multipart",
"content": [
{
"contentType": "multipart/alternative; Boundary=\"0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1\"",
"contentDisposition": "inline"
},
{
"contentType": "text/plain; charset=US-ASCII",
"data": "test rich text",
"boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
},
{
"contentType": "text/html; charset=US-ASCII",
"contentDisposition": "inline",
"data": "<html><body><font size=\"2\" face=\"sans-serif\"><b>test rich text</b></font></body></html>",
"boundary": "--0__=4EBB0925DFBB40F18f9e8a93df938690918c4EBB0925DFBB40F1"
}
]
}
}
The mask mainForm has the text-fields "title", "artist" , "ntracks" and the rich text-field "attachments".
How can I send an image as json and what is "boundary"?
Have you any idea , what's going wrong?
According to the documentation from IBM you need to use PUT (instead of POST) in order to update the fields.
After experimenting a little bit, I now know what was wrong. If I do the POST on the address http://localhost/Test/JSON_Views.nsf/api/data/documents?form=mainForm it works with the attachment. If I use http://localhost/Test/JSON_Views.nsf/api/data/collections/name/List?form=mainForm&computewithform=true the attachment field is ignored. But maybe you can explain me, what the extra field boundary is and if I can set the contentLocation by the name of my attachment?

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

Watson Assistant action to call IBM Cloud Function fails with Direct CloudFunctions calls are not supported on this platform

We are trying to implement cloud functions in Watson conversation but am receiving message 'Direct CloudFunctions calls are not supported on this platform'. When I googled for the error, I see that the issue could be because the region for WA and the cloud functions are different or not in US South/Germany. But I can confirm that both my WA and cloud functions are in US South.
I was trying in the 'Try out' panel. Below is the mock json editor content for my dialog node.
{
"context": {
"my_credentials": {
"user": "jgjg",
"password": "khk"
}
},
"output": {
"text": {
"values": [
"response text"
]
}
},
"actions": [
{
"name": "/<myIBMCloudOrganizationID>_<myIBMCloudSpace>/get-http-resource/weather",
"type": "server",
"parameters": {
"location": "Austin"
},
"credentials": "$my_credentials",
"result_variable": "$my_result"
}
]
}
Can you pls advise me on what am I doing wrong. Thanks.
I was going through the same issue. Cloud functions are only available in some regions. If your app is hosted in sydney or somewhere you cannot use that service there. Create a new app and set the location to london
Are you sure your user and password are set correctly?
Your user should consist of LETTERS and NUMBERS and some HYPHENS. like so : ...a-32d7-7d...
Your password should be just a string ...gafhWhu6alirEVpD...
Both are found in your api key on your IbmCloudFunctions page : https://console.bluemix.net/openwhisk/learn/api-key
Username is before the : of the api key and
Password after the : of the api key
If you already know this then i'm afraid i dont know how to help you.
Best

How do I use the Loopback where filter correctly on REST-API

Hi there I seem to miss some information about Loopback where clause or syntax. My problem is, that I receive an empty array if I try to get a list of matching model instances, does no difference if in loopback api explorer or trhough http api request.
My "subject" model:
[
{
"user": "string",
"semester": "string",
"subject_name": "string",
"subject_relevance": 1,
"subject_details": 0,
"id": "string"
}
]
One Instance of Subjects:
{
"user": "59eef907cc199c1cf8f99296",
"semester": "59eef6f8ebf12e1a37ee898b",
"subject_name": "Mathematik",
"subject_relevance": "1",
"subject_details": "",
"id": "59eef96aebf12e1a37ee898f"
}
My Loopback API Explorer filter:
{"where" : {"semester" : "59eef6f8ebf12e1a37ee898b"}}
My http request:
http://localhost:3000/api/subjects?filter[where][semester]=59eef6f8ebf12e1a37ee898b
The result I receive:
[]
If I try to search for this:
{"where" : {"subject_name" : "Mathematik"}}
or in browser:
http://localhost:3000/api/subjects?filter[where][subject_name]=Mathematik
I reveive the instance correctly or as expected. So I went thrugh the documentation and I strugle to find some hints or solutions to my problem. Can someone help me out or suggest me something to get the right instance back? Do I miss something? Has it to do that these are ID-fields or what is it?
Thanks for any help in advance!!
There are 2 ways to get your records based on where clause
one is by using 'findOne' method
get request
http://localhost:3000/api/subjects/findOne?filter[where][semester]=59eef6f8ebf12e1a37ee898b
Other one is using normal get request
http://localhost:3000/api/subjects?filter={"where":{"semester":"59eef6f8ebf12e1a37ee898b"}}
I am using loopback 4 and I had faced the same issue.
Here is the issue in loopback git
Solution is the add this setting in your #model decorator
#model({settings: {"strict":false, "strictObjectIDCoercion": true}})

Magento 2 REST API Customer Custom Attribute

The Magento 2 REST API Documentation explains a way to set custom_attributes on a customer when updating or creating it. http://devdocs.magento.com/swagger/index_20.html#/
Unfortunately I couldn't get this to work...
My POST and PUT JSON request data is :
{
"customer": {
"custom_attributes": [
{
"attribute_code": "firstname",
"value": "TEST"
}
],
"email": "someone#exaxmple.com",
"extension_attributes": [],
"firstname": "Someone",
"gender": null,
"lastname": "Else",
"middlename": null,
"taxvat": null,
"website_id": "1"
}
}
The Customer is created but the Firstname is not "TEST".
Is there anyone who had the same problem and fixed it? Please let me know how.
My best guess is that, since Firstname is an existing Out-Of-The-Box attribute - the OOTB attribute name-value mapping assignment will take precedence.
Could you try again, with a unique custom attribute name (i.e. something that doesn't clash with OOTB attribute names)
You will need to DEFINE a custom-customer-attribute before you can use the M2 API to perform operations on that custom-customer-attribute.
This StackExchange thread - https://magento.stackexchange.com/questions/88245/magento2-create-a-customer-custom-attribute - has additional information on how to go about setting up a custom-customer-attribute.