I would like to handle assertion property content according to below responses, for both success and failure.
Success response:
{
"task": "userLogin",
"response": {
"code": 0,
"status": "success",
"error_message": "",
"success_message": "",
"data": {
"userId": "65",
"username": "indian",
"email": "test#gmail.com",
"token": "b0aef6139ffdc1041e01f7587a0dcf61",
"userType": "trial",
"profile_picture": "test.png"
}
}
}
Failure response: will have only the data node missing, and remaining nodes will be present.
"data":
{
"userId": "65",
"username": "indian",
"email": "test#gmail.com",
"token": "b0aef6139ffdc1041e01f7587a0dcf61",
"userType": "trial",
"profile_picture": "test.png"
}
You can use a very simple XPath assertion, keeping in mind that internally SoapUI converts everything into XML representation.
XPath:
exists(//*:data)
Expected:
true
Update based on your comments.
Your original requirement was not clear. The node is present it is just empty. In that case the XPath assertion would be:
empty(//*:data)
Expected:
false
Handy XPath reference.
Related
I was using identity verification feature from Docusign with envelopes. Previously, envelopes are working fine without it. Then I enabled this feature and searched on the Docusign API Documentation, how to implement this feature. I got the necessary details like authentication token, workflow id. Try to hit the endpoint using Post request. Everything's fine but having issues in the body part of the post request getting invalid phone number response. Thank you for your time! Please help!
//Post request endpoint
https://demo.docusign.net/restapi/v2.1/accounts/f8594d59-9d52-xxxx-xxxx-xxxxxxxxxxxx/envelopes
//header
Authorization: Bearer {accestoken}
Content-Type: application/json
Acces: application/json
//request body
{
"accountId": "f8594d59-9d52-xxxx-xxxx-xxxxxxxxxxxx",
"templateId": "4e2ba389-5d26-xxxx-xxxx-xxxxxxxxxxxx",
"emailSubject": "Please sign the contract",
"templateRoles": [
{
"roleName": "Sender",
"name": "Name",
"email": "fName.lName#xyz.com",
"identityVerification": {
"workflowId": "c368e411-1592-xxxx-xxxx-xxxxxxxxxxxx",
"steps": null,
"inputOptions": [
{
"name": "phone_number_list",
"valueType": "PhoneNumberList",
"phoneNumberList": [
{
"countryCode": "1",
"number": "8956324511"
}
]
}
]
}
},
{
"roleName": "Customer",
"name": "cFName",
"email": "cFName.cLName#gmail.com"
}
],
"status": "sent"
}
//Response
{
"errorCode": "PHONE_NUMBER_INVALID",
"message": "Phone number is not valid."
}
//Expected Response can vary
{
"envelopeId": "e8342cd0-ea2b-xxxx-xxxx-xxxxxxxxxx",
"uri": "/envelopes/e8342cd0-ea2b-xxxx-xxxx-xxxxxxxxxx",
"statusDateTime": "2023-01-13T05:22:35.0100000Z",
"status": "sent"
}
According to https://www.areacodehelp.com/where/area_code_895.shtml area code 895 is not valid.
Try with a valid phone number to confirm the issue, but to me it looks like the number you used here is indeed not a valid phone number.
PS
If you meant to use a number in Azerbaijan, you need to change the country code from "1" to "895" as it's a country code for a different country (the way you have is if for the USA)
So, basically what I found is ID verification won't work with template roles because of the syntax compatibility. But it will work with composite templates, I made it work with composite template.
Additionally, both of the methods are compatible idVerification or phoneAuthentication. I am using idVerification for the first Signer and phone Authentication for the second signer
Docusign docs have more methods as well like sms auth, etc. Explore it from these links:
https://developers.docusign.com/docs/esign-rest-api/how-to/phone-auth/
https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/
Check examples, in my usecase I explored Generic JSON Request/Response
Thanks for all the support from Inbar and the community!
{
"accountId": "f8594d59-9d52-xxxx-xxxx-xxxxxxxxxx",
"emailSubject": "Please sign the contract",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"serverTemplates": [
{
"sequence": "1",
"templateId": "4e2ba389-5d26-xxxx-xxxx-xxxxxxxxxx"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"roleName": "Sender",
"recipientId": "1",
"name": "Name",
"email": "fName.lName#xyz.com",
"identityVerification": {
"workflowId": "c368e411-1592-xxxx-xxxx-xxxxxxxxxx",
"steps": null,
"inputOptions": [
{
"name": "phone_number_list",
"valueType": "PhoneNumberList",
"phoneNumberList": [
{
"countryCode": "1",
"number": "1234567890"
}
]
}
]
}
},
{
"roleName": "Customer",
"recipientId": "2",
"name": "cName",
"email": "cfName.clName#gmail.com",
"phoneAuthentication": {
"senderProvidedNumbers": [
"+11234567890"
],
"recipMayProvideNumber": false
},
"idCheckConfigurationName": "Phone Auth $"
}
]
}
}
]
}
]
}
Note: Use valid phone number!
So I have a JSON file I got from Postman which is returning as an empty object. This is how I'm reading it.
import regscooter from './json_files/reginald_griffin_scooter.json'
const scoot = regscooter;
const CustomerPage = () => {...}
reginald_griffin_scooter.json
{
"success": true,
"result": {
"id": "hhhhhhhhhh",
"model": "V1 Scooter",
"name": "hhhhhhhhhh",
"status": "active",
"availabilityStatus": "not-available",
"availabilityTrackingOn": true,
"serial": "hhhhhhhhhhhh",
"createdByUser": "hhhhhhhhK",
"createdByUsername": "hhhhhhhh",
"subAssets": [
"F0lOjWBAnG"
],
"parts": [
"hhhhhhhh"
],
"assignedCustomers": [
"hhhhhhhhh"
],
"createdAt": "2019-12-03T21:47:26.218Z",
"updatedAt": "2020-06-26T22:05:54.526Z",
"customFieldsAsset": [
{
"id": "hhhhhhh",
"name": "MAC",
"value": "hhhhhhhh",
"asset": "hhhhhhhhhh",
"user": "hhhhhhhhh",
"createdAt": "2019-12-03T21:47:26.342Z",
"updatedAt": "2019-12-11T16:29:24.732Z"
},
{
"id": "hhhhhhhh",
"name": "IMEI",
"value": "hhhhhhh",
"asset": "hhhhhhh",
"user": "hhhhhhhhhh",
"createdAt": "2019-12-03T21:47:26.342Z",
"updatedAt": "2019-12-11T16:29:24.834Z"
},
{
"id": "hhhhhhhhh",
"name": "Key Number",
"value": "NA",
"asset": "hhhhhhhhh",
"user": "hhhhhhhhhhh",
"createdAt": "2019-12-03T21:47:26.342Z",
"updatedAt": "2019-12-11T16:29:24.911Z"
}
]
}
}
The error is that "const scoot" is being shown as an empty object {}. I made sure to save a ton of times everywhere. I am able to read through the imported JSON file in other variables in similar ways, so I don't know why I can't parse this one. I just want to access the JSON object inside this. Also I omitted some information with hhhhh because of confidentiality.
EDIT: The code works, but it still has a red line beneath result when I do:
const scoot = regscooter.result.id;
It would be much more effective if you will provide an example in codesandbox or so.
However at first look it might be a parser issue ( maybe you are using Webpack with missing configuration for parsing files with json extension ), meaning we need more information to provide you with a full answer ( maybe solution ? ).
Have you tried to do the next:
const scoot = require('./json_files/reginald_griffin_scooter.json');
Background
When I use Outlook client to send a mail with inline image.
The image in html email looks like this, which has cid:
<img size="100" src="cid:3bb599fc-f3eb-465b-af83-aa6a495f563a" style="max-width:100%">
When I use
GET /me/messages/{messageId}/attachments
The contentId in the result returned matched the cid in html.
{
"value": [
{
"#odata.type": "#microsoft.graph.fileAttachment",
"id": "aaa",
"lastModifiedDateTime": "2017-11-30T09:32:09Z",
"name": "image.png",
"contentType": "image/png",
"size": 100,
"isInline": true,
"contentId": "3bb599fc-f3eb-465b-af83-aa6a495f563a",
"contentLocation": null,
"contentBytes": "validBase64Bytes"
}
]
}
Using Microsoft Graph API
Now I am trying to use Microsoft Graph API to add inline image.
POST /me/messages/{messageId}/attachments
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "1.jpg",
"isInline": true,
"contentBytes": "validBase64Bytes"
}
However, the contentId is null in the result returned.
{
"#odata.type": "#microsoft.graph.fileAttachment",
"id": "aaa",
"lastModifiedDateTime": "2017-11-30T09:35:50Z",
"name": "1.jpg",
"contentType": "image/jpeg",
"size": 100,
"isInline": true,
"contentId": null,
"contentLocation": null,
"contentBytes": "validBase64Bytes"
}
And if I set contentId manually in POST
POST /me/messages/{messageId}/attachments
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "1.jpg",
"isInline": true,
"contentId": "myContentId",
"contentBytes": "validBase64Bytes"
}
It will return the error
{
"error": {
"code": "BadRequest",
"message": "Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.",
"innerError": {
"request-id": "36e95f0a-ad75-46c6-b86c-d585a150b96d",
"date": "2017-11-30T09:37:41"
}
}
}
So how to add inline image correctly?
Weird, I tried to run the exact same code again, it won't give me any error now.
POST /me/messages/{messageId}/attachments
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "1.jpg",
"isInline": true,
"contentId": "myContentId",
"contentBytes": "validBase64Bytes"
}
Not sure whether it is a temporary issue. I will inform Microsoft team to check the log.
If I am wrong for how to use the API, please definitely point out. Thanks.
I will leave it here for future people to save some time to implement adding inline image.
I have a REST Web Services Call that is returning data in the following format:
{
"Id": "0497cee4-45dc-47d8-97a8-b45ad8018775",
"Status": "OK",
"ProviderName": "MyApp",
"DateTimeUTC": "/Date(1508348383277)/",
"Contacts": [
{
"ContactID": "1efa0ea1-de5c-4172-869c-816e27c3c825",
"ContactStatus": "ACTIVE",
"Name": "Company",
"FirstName": "Joe",
"LastName": "Bob",
"EmailAddress": "mainguy#here.com",
"BankAccountDetails": "",
"ContactPersons": [
{
"FirstName": "Operations",
"LastName": "",
"EmailAddress": "there#here.com",
"IncludeInEmails": true
},
{
"FirstName": "Another",
"LastName": "Contact Email",
"EmailAddress": "here#there.com",
"IncludeInEmails": true
}
],
"HasAttachments": false,
}
]
}
Within Microsoft Flow I would like to grab the main contact email (Contacts.EmailAddress) as well as all of the secondary Contacts Emails (Contacts.ContactPersons[x].EmailAddress); and use that for the too field of down-flow email.
ContactPersons will not always be defined in every case, but Contacts.EmailAddress should be.
What is the best way to do this with a flow? Is there a way to concatenate data over a loop or something? I can't seem to find a way to do it.
Try using Data Operations (https://learn.microsoft.com/en-us/flow/data-operations).
You can start off with a Select, picking the EmailAddress field in the Map, and then redirecting that to a Join and using that output.
I am attempting to display some data from JSON that contains parsed XML, in an angular application, and I am stuck.
I can extract the other fields like so {{object.articleId}}. How can I extract child data from the content object? For example, if I need to extract the "default-locale"? I would like to be able to do {{object.content.default-locale}} but this is not working obviously.
[
{
"articleId": "393800",
"classNameId": 0,
"classPK": 0,
"companyId": 10157,
"content": "{\"root\":{\"default-locale\":\"en_US\",\"dynamic-element\":[{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"[\\\"General News\\\"]\",\"language-id\":\"en_US\"},\"name\":\"Top_News\",\"type\":\"radio\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"_All\",\"language-id\":\"en_US\"},\"name\":\"Location\",\"type\":\"list\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"CTC\",\"language-id\":\"en_US\"},\"name\":\"Business_Unit\",\"type\":\"list\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"hfhfahfcaf;\",\"language-id\":\"en_US\"},\"name\":\"Subtitle\",\"type\":\"text\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"dhfhfowejfwkfpw\",\"language-id\":\"en_US\"},\"name\":\"Intro_Text\",\"type\":\"text\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"1430697600000\",\"language-id\":\"en_US\"},\"name\":\"News_Date\",\"type\":\"ddm-date\"},{\"index\":0,\"index-type\":\"\",\"dynamic-content\":{\"content\":\"/image/journal/article?img_id=393803&t=1430750130449\",\"id\":393803,\"language-id\":\"en_US\"},\"name\":\"News_Image\",\"type\":\"image\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"flkdsjfldsjffa\",\"language-id\":\"en_US\"},\"name\":\"Freeform\",\"type\":\"text_area\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"content\":\"test\",\"language-id\":\"en_US\"},\"name\":\"News_Tag_1\",\"type\":\"text\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"language-id\":\"en_US\"},\"name\":\"News_Tag_2\",\"type\":\"text\"},{\"index\":0,\"index-type\":\"keyword\",\"dynamic-content\":{\"language-id\":\"en_US\"},\"name\":\"News_Tag_3\",\"type\":\"text\"}],\"available-locales\":\"en_US\"}}",
"createDate": 1430750130000,
"description": "",
"descriptionCurrentValue": "",
"displayDate": 1430749860000,
"expirationDate": 1430836418000,
"folderId": 236650,
"groupId": 10184,
"id": 393801,
"indexable": true,
"layoutUuid": "",
"modifiedDate": 1430836418000,
"resourcePrimKey": 393802,
"reviewDate": null,
"smallImage": false,
"smallImageId": 393804,
"smallImageURL": "",
"status": 3,
"statusByUserId": 10439,
"statusByUserName": "Admin",
"statusDate": 1430836418000,
"structureId": "236652",
"templateId": "236654",
"title": "<?xml version='1.0' encoding='UTF-8'?><root available-locales=\"en_US\" default-locale=\"en_US\"><Title language-id=\"en_US\">Test</Title></root>",
"titleCurrentValue": "Test",
"treePath": "/236650/",
"type": "general",
"urlTitle": "test",
"userId": 10439,
"userName": "Admin",
"uuid": "f06c946e-6efb-4a28-81f3-2a78e1a20814",
"version": 1.0
}
]
Thanks in advance for your assistance
content is actually a json string.
You need to loop over that data when you receive it and set:
object.content = angular.fromJson(object.content);
Perhaps this could be also cleaned up at source if you control the api that is sending it