Is there any easy method to getting the Column Title when using GET Row with the Smartsheet API? - smartsheet-api

Is there any easy method to getting the Column Title when using GET Row with the API? New to API. I'm utilizing Microsoft Power Automate for these calls to push updates to Teams and such (more custom than what comes natively from Smartsheet).
I'm utilizing this address from the documentation:
https://api.smartsheet.com/2.0/sheets/{SheetID}/rows/{rowID}, and then I add this string to the end of that URL to get discussions and columns: "?include=discussions,columns"
which will include a separate array named "Columns".
What I'm wanting to do is get the "Column title" within the initial GET Row action. It would show up within the "cells" array when doing a GET Row API call.
Here's an example of what is obtained in the "cells" array when GET Row is used:
"cells": [
{
"columnId": 4151830841190276,
"value": "New task.",
"displayValue": "New task."
}
]
And here's an example of what's obtained in that Columns array, which comes separate:
"columns": [
{
"id": 4151830841190276,
"version": 0,
"index": 3,
"title": "Item Name",
"type": "TEXT_NUMBER",
"primary": true,
"validation": false,
"width": 300
}
Which is fine, I can do lookups to bridge the gap between the ColumnID I obtain from "get row" and the Columns array that's also returned...but ideally I'd like to just get the ColumnID Title in the native "GET Row" action, preventing this workaround. Any ideas, or am I doing it the best way?

You can't get column information (title, type, options...) while specifically reading rows.
You have 2 options:
Make another call to get the column information
https://smartsheet-platform.github.io/api-docs/#get-column)
Read all
the sheet (both columns and rows at once)
https://smartsheet-platform.github.io/api-docs/#get-sheet
Both solution should be working, I would suggest the second solution since only one API call is needed, but need more work processing the data.

Related

Azure DevOps Picklist howto know which ID is for what picklist?

When I GET the picklist by id using the REST api, it returns a json like this.
{
"items": [
"Orange",
"Blue"
],
"id": "65a8a40d-6c22-45ce-af0a-bdfdfdfd335",
"name": "picklist_aef2c045-0d2d-4f92-kjdf-56eea553e1ef",
"type": "String",
"isSuggested": false,
"url": "https://dev.azure.com/organization/_apis/work/processes/lists/65a8a40d-6c22-45ce-af0a-bdfdfdfd335"
}
My current aim is to make a script that updates the items within a picklist, but in order to update, I need to know the id of that picklist. All I know from azure devops is the label of the picklist. Is there a way to get the corresponding id with the label? Or is there an alternative? Even if I get the entire list of all picklists within the collection, it still doesn't tell me which is associated to which label so it's not usable for me.
Is there a way to get the corresponding id with the label? Or is there an alternative?
The essence of Picklist is the work item field.
You could get the target PickList id with the Rest API: Fields - Get or Fields - List.
The custom picklist field name: custom.fieldname.
For example:

Choosing VSTS Kanban column when creating an EPIC using the VSTS REST API

I am creating a VSTS Kanban Epic using the REST API. This creates an Epic in the first column of the Kanban.
I want to be able to choose which column it goes into, and also as a second operation be able to move it from column to column using the REST API.
Looking at the list of fields available there is a field 'System.BoardColumn' - is this the correct field to modify to alter the Epic's column?
Thanks
You just need to specify the System.State field value (New, In process and Done) in REST API, then it will go the related column. Since New is the default value for System.State field, it will create in first column if you are not specify the value for System.State.
Create Epic in second column
To create an Epic shows in second column (In process) of Epics board, you can use create a work item REST API. Such as below example (create Epic epic3):
PATCH https://account.visualstudio.com/DefaultCollection/Git2/_apis/wit/workitems/$Epic?api-version=1.0
Content-Type: application/json-patch+json
[
{
"op": "add",
"path": "/fields/System.Title",
"value": "epic3"
},
{
"op": "add",
"path": "/fields/System.State",
"value": "In Progress"
}
]
Then the epic3 will show in second column:
Update an existing Epic from a column to another column
You just need to replace the value for System.State field by update a field REST API.
Such as above example, to move e1 (id=53) from first (New) column to second (IN process) column:
PATCH https://marinaliu.visualstudio.com/DefaultCollection/_apis/wit/workitems/53?api-version=1.0
Content-Type: application/json-patch+json
[
{
"op": "replace",
"path": "/fields/System.State",
"value": "In Progress"
}
]
Then the work item e1 will show in the second column:

Neo4J REST Unique Nodes

My question is two parts:
First, when trying to create a unique node using the REST Interface like below...
http://localhost:7474/db/data/index/node/people?uniqueness=create_or_fail
What is the meaning of the "person" portion of the URL. I'm under the impression that it is a label but I'm not sure.
Second, if it is indeed a label, when I execute the following REST call...
http://localhost:7474/db/data/index/node/Test?uniqueness=create_or_fail
with this payload...
{
key: "name",
value: "test",
properties:
{
"lastName": "test",
"name": "test",
"type": "test",
"firstName": "test"
}
}
A node is created but does not have an associated label. It creates a label-less node that does still enforce uniqueness. How do I create a unique node using the REST API with a label?
I'm using neo4j 2.0.
You are correct. When you send in JSON, it will create the node, or fail if it already exists using the index label 'people'
When sending, you need to have in your object a "key" and "value" which denotes how to do the index matching.
How are you determining that the node has no label? In the REST documentation, I can see that the labels is a different URL call for a node, have you checked there?

Create event with a venue with Graph API

Is it possible to set the venue when creating a location using Graph API? So that it's actually linked to the Facebook Place.
The goal is to show the map, but I'm fairly certain that for some reason requires a Place.
{
"name": "Dans till Zlips",
"start_time": "2011-09-11T00:00:00",
"end_time": "2011-09-11T03:00:00",
"location": "Yesterday",
"street": "Skyttevägen 4",
"city": "Vallentuna",
"country": "Sweden"
}
I think this should show a place. It does not. Setting longitude, latitude or venue id (suppose that's the id of the Place) does not work.
Right now I have to manually change the location in the event edit menu if I want to have it linked, which isn't really fun or feasible when you have a couple of hundred events.
There's a (currently undocumented) parameter which will mark a created event as taking place at a particular Place - When creating the event add the location_id parameter and set it to the ID of the Facebook Place you want

Updating BigCommerce Pricing in Bulk with API

I am trying to figure out the best way to update our prices via the API
Normal SKUs are fine, but the price of items with options seems a little less straightforward.
Using the GET v2/products?sku=XXXX there is only the base price of the item, not the price of the item with the option(s) selected
We also need the SKU of the item when the option(s) is(are) selected as my updated price list has SKU and Price
What is the best method of gathering this information, and then updating the prices?
Thanks for your help!
The V3 API provides a much better interface for this.
If all of your product's options are related to SKUs, you can GET all of the details of the product with its variants via
/v3/catalog/products?include=variants
This will show you option information along with all pricing - the calculated_price property will give you an idea of what the real price will be when you click on the option values for that SKU on the storefront - so it will take into account (for example) Product Rules and other things that might be going on in the background.
Editing SKUs (such as their price) can also be done via the endpoint.
Example:
PUT /v3/catalog/products/6606?include=variants (where 6606 is the Product ID)
{
"variants": [
{
"id": 25858,
"product_id": 6606,
"price": 10
},
{
"id": 25859,
"product_id": 6606,
"price": 11
},
{
"id": 25860,
"product_id": 6606,
"price": 13
}
]
}
This would update the prices of these 3 variants on the product (you'd get their IDs from the GET response).
If the product is "simple", meaning it has no child SKUs, you'll also see the product represented as a variant with sku_id=null. So you can actually use this endpoint to update the prices of simple products as well.