curl command for LIST string data type - jax-rs

I've a formal parameter as List example in webservice. How to pass curl command for the list of string to POST data.
Appreciate your help regarding this matter.
Thanks,
Blessy

Related

How to convert date (1991-08-23T00:00:00) which is captured in response and then convert this format (08-23-1991) in vugen?

I am working on a script where I need to submit a form and do some authentication during the steps. I am using LoadRunner Vugen for scripting. For one of the request's response I can see birthdate is coming like below:
"suffixName": ""
"birthDate": "1991-08-23T00:00:00",
"agencyName": ""
In another later request I can see in jason body the same date is used like below
"Body={\agentSuffix":null,"agentFirstName":"XYZ","agentLastName":"WSD","agentBirthDate":"08-23-1991" and so on with additional body.
I am able to capture the date from response by using web_reg_save_param_ex. But now how do I convert the value so that I can use it in next jason body in a custom request. I just need help to capture it.
Captured value: 1991-08-23T00:00:00
Expected value: 08/23/1991
Thanks in advance
Correlate for the string
Use your programming skills in the language of your virtual user to transform transform the string into a new string. Your test code might be C, JavaScript, Java, ... so use language-appropriate string conversion functions.
Hints
"LB=birthDate":"", "RB=T00:00:00"
Conside the loop and what this means for the use of substring and sprintf();
for (counter=0;counter<=strlen(lr_eval_string(MyCorrelatedVarName));counter++)
{ lr_message("%s",&lr_eval_string(MyCorrelatedVarName)[counter]); }

How to personalise email on infobip

Please how can I add custom placeholder to the portal editor for infobip email service.
I have created a template with the portal design editor and I want to dynamically add placeholders like the recipients first name or the recipients and invoice ID or any other necessary data concerning the recipient, I'm trying to create an invoice email for my customers.
From the API documentation, I have seen the place to pass in the template ID but I'm not seeing any place where I can pass in my own custom variables for the custom recipient data. so please help if there is any and thanks.
Easiest way would be to define placeholders in the template you save. Like this: {{customer_name}} {{invoice_no}} and then when you use the template Id in API request you would have to send via API something like this:
curl --location --request POST 'https://api.infobip.com/email/2/send' \
--header 'Authorization: Basic Authorization==' \
--form 'templateID="Your_template_id"' \
--form 'to="{
\"to\": \"Customer1#customer1.com\",
\"placeholders\": {
\"customer_name\": \"Customer 1\",
\"invoice_no\": \"1\"
}
}
"' \
--form 'to="{
\"to\": \"customer2#gmail.com\",
\"placeholders\": {
\"customer_name\": \"*customer 2\",
\"invoice_no\": \"2\"
}
}"'
I have been using as EmailJs before. Their integration is extremely simple and straight forward.

JIRA API GET all values for a custom field

I'm trying to get all possible values for a customfield on JIRA through the GET api.
Example:
I created the "Test API" custom field and gave it three values "API 1", "API 2" and "API 3". The id for this field is 18232.
I'm trying to do this with the following:
https://my-domain.atlassian.net/rest/api/2/customFieldOption/18232
I got this from here
The headers are one for basic authorization and one with Accept - application/json
No matter what I try to do I keep getting the error
{"errorMessages":["A custom field option with id '18232' does not exist"],"errors":{}}
Has anyone been sucessful with this?
I have followed the following and I was able to get what I was looking for, hope this helps!
Request:
curl -D- -u username:password -X GET -H "Content-Type: application/json" https://my-domain.atlassian.net/rest/api/2/customFieldOption/10150
Response:
{"self":"https://my-domain.atlassian.net/rest/api/2/customFieldOption/10150","value":"AUG-1999"}
Hope this helps!
That rest API call only give you a custom field OPTION value, if you want to list all options of customFileld i think you need a webserviceplugin.

how to get JSON data from an API in robot framework

I am trying to get JSON data from an API in robot framework which has data with id's. I have to get the count of id's present in the data obtained from the API.
I have tried the below code:
${result} = get ${API_JSON_PATH}
Should Be Equal ${result.status_code} ${200}
${json_data} = Set Variable ${result.content}
Log ${json_data}
I am getting the below mentioned error:
No keyword with name '${result} = get' found.
Is the approach correct or is there any other better ways for getting the JSONS data?
I'm using the RequestsLibrary and it's slide different from what you are doing.
the credential are not needed in your case but this is the example:
#{credential}= Create List Your_Username Your_Password
Create Session YOUR_API_ALIAS YOUR URL auth=#{credential}
${api}= Get Request YOUR_API_ALIAS YOUR_URI
if you want get the content of the JSON:
${api.json()}
Documentation: https://bulkan.github.io/robotframework-requests/
You need to have two or more spaces after the =. Robot looks for two or more spaces to find keywords and arguments, so it thinks your first statement begins with the keyword ${result} = get. Since that's not a valid keyword, you get that error.

Softlayer API: filter image by OS referenceCode

I am trying to filter out my list of images by OS reference code. Here is the url I am trying:
https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups.json?objectMask=mask[flexImageFlag]&objectFilter={'children': {'blockDevices': {'diskImage': {'softwareReferences': {'softwareDescription': {'referenceCode': {'operation': 'REDHAT_6_64'}}}}}}}
But I am kept getting the following error msg:
{"error":"Unable to parse object filter.","code":"SoftLayer_Exception_Public"}
Can anyone help me see what is wrong? Thanks in advance!
Q.Z.
The filter is wrong, but in my tests the filter is not working with the "referenceCode" property; you need to use another property such as name, version or both. See below the examples:
using name and version property
https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups?objectMask=mask[flexImageFlag]&objectFilter={"blockDeviceTemplateGroups": {"children":{"blockDevices":{"diskImage":{"softwareReferences":{"softwareDescription":{"name":{"operation":"CentOS"}, "version":{"operation":"6.3-32"}}}}}}}}
Using only a property (name in this case)
https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups?objectMask=mask[flexImageFlag]&objectFilter={"blockDeviceTemplateGroups": {"children":{"blockDevices":{"diskImage":{"softwareReferences":{"softwareDescription":{"name":{"operation":"CentOS"}}}}}}}}
Regards
Looks like you are using the REST api. The example in the
API reference, suggests that this parameter should be in JSON format:
https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask[id,hostname]&objectFilter={"datacenter":{"name":{"operation":"dal05"}}}
Your error says "Unable to parse object filter.", so the error is probably just be that your parameter is invalid JSON: The JSON standard only accepts double quotes.
Try replacing
{'children': {'blockDevices': {'diskImage': {'softwareReferences': {'softwareDescription': {'referenceCode': {'operation': 'REDHAT_6_64'}}}}}}}
with the corresponding valid json:
{"children": {"blockDevices": {"diskImage": {"softwareReferences": {"softwareDescription": {"referenceCode": {"operation": "REDHAT_6_64"}}}}}}}