Smartsheet - add row with multiple values in cell using c# sdk - smartsheet-api

One of columns has 'Contact List' type with checked 'Allow multiple contacts per cell' see example.
I tried to add row using smartsheet-csharp-sdk(v2.3). Cell object:
new Cell
{
ColumnId = 111111,
Value = "Test#test.com",
Strict = false
}
and I got the next error:
{
"errorCode": 1235,
"message": "Value is not supported for this column type. Use objectValue instead.",
"refId": "163zew9slvgfq",
"detail": {
"index": 0
}
Then I tried to find how to pass ObjectValue and found only how pass 'Predecessor List', but nothing about multi 'Contact List'.
Question: How to add multi contact list cell using C# SDK ?

Welcome to Stack Overflow, o.jev!
Unfortunately, the C# SDK does not currently support the multi-contact columns. If you wanted to update the value of a multi-contact cell, you'd have to make a native HTTP call (not using the SDK). This would require making a PUT request to the row you want to update, and then your HTTP request body would look like this:
{
"cells": [
{
"columnId": 6654716978456452,
"objectValue": {
"objectType": "MULTI_CONTACT",
"values": [
{
"objectType": "CONTACT",
"email": "user1.email#smartsheet.com"
},
{
"objectType": "CONTACT",
"email": "user2.mail#smartsheet.com"
}
]
}
}
]
}

Related

how to generate multiple text fields based on a GET api and post it back

I have an endpoint that returns a list of questions. Each question has the following properties
Input field name eg: Select from the following list
Validation eg: IsRequired
controlType eg: (dropdown, text, image, file)
values eg (dart, javascript, python)
I want to build input forms on the fly on mobile when i get this endpoint. How do i go about this on flutter. I already have the api.
Think of it like a quiz app but with different controls. eg. dropdown, textfield, checkbox.
Here is an example of the api response
[
{
"question": "what is your name ?",
"cotrollType": "textField",
"values": [],
"validations": [
{
"validation": "IsRequired"
}
]
},
{
"question": "select from the dropdown:",
"cotrollType": "dropdown",
"values": ["one", "two", "three"],
"validations": [
{
"validation": "IsRequired"
}
]
},
]
yeah more code is needed but probably you could just use BloC to get the API response and create the Widgets there and then just emit them as new state, that way you can show some sort of progress indidcator in the meantime, also are you using some kind of model to parse the response and make it a bit easier?

In Katalon Studio, how can i check JSON metadata

I am configuring Katalon Studio for WebAPI testing. I want to test the metadata (schema) check for the JSON received from API. How can I do that? Please suggest.
You can check if you receive the expected JSON by extending the code in the "Validation" tab of your REST method. The statement that allows you to do this is the following:
WS.verifyElementPropertyValue(response, contentOf, withPrecision)
So, if you expect a JSON like this: { "id":1, "name":"Joe" }, you can use the following code:
WS.verifyElementPropertyValue(response, 'id', 1)
WS.verifyElementPropertyValue(response, 'name', 'Joe')
Katalon Studio offers another option too:
boolean successful = WS.validateJsonAgainstSchema(response,schema)
This way you can check a previously defined schema. Remember the schema must be String type. Katalon Studio autogenerate the following example:
String jsonPass =
"""
{
"\$id": "https://example.com/person.schema.json",
"\$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
"""
boolean successful = WS.validateJsonAgainstSchema(response,jsonPass)
If you need more information about this (or a better explanation), check here Katalon documentation:
ws-send-request-and-verify
ws-validate-json-string-against-a-schema
Hope it helps you!

Validate referential integrity of object arrays with Joi

I'm trying to validate that the data I am returned it sensible. Validating data types is done. Now I want to validate that I've received all of the data needed to perform a task.
Here's a representative example:
{
"things": [
{
"id": "00fb60c7-520e-4228-96c7-13a1f7a82749",
"name": "Thing 1",
"url": "https://lolagons.com"
},
{
"id": "709b85a3-98be-4c02-85a5-e3f007ce4bbf",
"name": "Thing 2",
"url": "https://lolfacts.com"
}
],
"layouts": {
"sections": [
{
"id": "34f10988-bb3d-4c38-86ce-ed819cb6daee",
"name": "Section 1",
"content:" [
{
"type": 2,
"id": "00fb60c7-520e-4228-96c7-13a1f7a82749" //Ref to Thing 1
}
]
}
]
}
}
So every Section references 0+ Things, and I want to validate that every id value returned in the Content of Sections also exists as an id in Things.
The docs for Object.assert(..) implies that I need a concrete reference. Even if I do the validation within the Object.keys or Array.items, I can't resolve the reference at the other end.
Not that it matters, but my context is that I'm validating HTTP responses within IcedFrisby, a Frisby.js fork.
This wasn't really solveable in the way I asked (i.e. with Joi).
I solved this for my context by writing a plugin for icedfrisby (published on npm here) which uses jsonpath to fetch each id in Content and each id in Things. The plugin will then assert that all of the first set exist within the second.

Trying to insert rows with smartsheet-api and php

I am able to update a row easily, but for the life of me can't get a new row inserted.
Here's my data:
{
"toTop":true,
"cells": [
{
"columnId": 5830169266022276,
"value": true
},
{
"columnId": 5830169266022276,
"value": "New status",
"strict": false
}
]
},
{
"toTop":true,
"cells": [
{
"columnId": 5830169266022276,
"value": true
},
{
"columnId": 5830169266022276,
"value": "New status",
"strict": false
}
]
}
The error I get is:
Required object attribute(s) are missing from your request: id.
Help, please!
Based on that error message, I'd suspect that perhaps you're trying to use the verb PUT on your "Add Row" request. (If you're sending PUT, then Smartsheet thinks you want to update a row and therefore requires that you specify the id of the row.) The command to Add a Row should use the verb POST:
POST /sheets/(sheetId}/rows
Also, I notice that you're specifying the same cell (i.e., columnId) twice for each row. This might be problematic as well. Each row object should contain cell objects corresponding to columns that you want to update in that row -- and columnId value should not be repeated/duplicated within a given row.

Create large text field in Eloqua using REST API

I was trying to create custom object and corresponding fields in Eloqua. While creating a field with datatype largeText it throws validation error. I can create fields with datatypes like date, text, numeric etc. How can I create largeText fields?
This is my request body
{
"type": "CustomObject",
"description": "TestObject",
"name": "TestObject",
"fields": [
{
"type": "CustomObjectField",
"name": "Description",
"dataType": "largeText",
"displayType": "text"
}
]
}
Response is [Status=Validation error, StatusCode=400]
You should use "displayType":"textArea"for creating largeText fields.