Is it possible to copy sheets over for new budget year, including outbound links? - smartsheet-api

I have about 75 sheets I have created for our 2019 fiscal year that list budget and actual values for certain company expenses, which link out to a few different summary sheets based on region. I wanted to copy all sheets and blank them out to roll out for the 2020 fiscal year. When I use the Smartsheet API to copy a sheet, it only allows me to copy over inbound links, not outbound ones. Is there a way to copy over outbound links, even to a new sheet?
For reference, I ran the copy sheet code located on the Smartsheet API github page:
curl https://api.smartsheet.com/2.0/sheets/[sheet ID]/copy?include=data,attachments,cellLinks
-H "Authorization: Bearer [token]"
-H "Content-Type: application/json"
-d '{
"destinationType": "home",
"destinationId": null,
"newName": "newSheetName"
}'
-X POST

At this time when making a copy of a sheet, via the API or the UI in your browser, it will only save the inbound cell links. Outbound cell links will be removed with the cell data remaining in place in the newly created sheet. There currently isn't a method to keep the cell links in place via the copy. They would need to be recreated after the copy is done.

Related

Custom location text for GitHub organization

How do I set a custom text for the location field of my GitHub organization? Such as the one below:
Under the settings of the organization, I can only find a drop-down menu that lets me select a country.
A little late to the game, but this solved my issue!
For organizations:
curl -H "Authorization: bearer GH_PAT_HERE" -d '{"location":"YOUR CUSTOM LOCATION"}' https://api.github.com/orgs/ORG_NAME
Additionally for users:
curl -H "Authorization: bearer GH_PAT_HERE" -d '{"location":"YOUR CUSTOM LOCATION"}' https://api.github.com/user
Credit: https://github.community/t/setting-custom-location-for-github-free-organizations/193506/2
The previous method didn't work for me in 2022, but I found something much simpler.
First, go to your organisation settings.
Next, open DevTools and find the element with ID organization_profile_location. Change its value to whatever you like.
Finally, press "Update profile" to save your changes. Use this method at your own risk, as it is not official.
According to Teddy van Jerry (someone in the comments), this isn't valid for requesting publisher verification.

Delete multiple issue/PR comments via the GitHub API

I want to delete multiple PRs/issues comments at once with GitHub Actions over the GitHub API.
Is there a way to do this without showing the delete message multiple times like the following image?
For example, I thought there may be a way to delete multiple issue/pull request review comments with one request that shows a message like <user> deleted n comments from <users whose comments have been deleted>?
Currently, I am deleting messages using the following curl command in a loop:
echo "$ids" | while read -r id; do
curl -X "DELETE" -s -H "authorization: token $GITHUB_TOKEN" -H "User-Agent: Actions-<username>/<reponame>" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/<username>/<reponame>/issues/<issue number>/comments/$id"
done
If it is a pull request, I use pulls with instead of issues.
I also think that there is a rate limit preventing the deletion of that many commands in such a short time.
See the docs for deleting an issue and a pull request comment.
[Context]
I want to create a command that clears multiple messages at once. If somebody enters /clear 5 for example, the latest 5 messages will be deleted.
No, you can't do it. It is a core feature from Github to create a timeline event on any action (like push, comment, rebase, merge, etc). That's a standard placeholder.
https://help.github.com/en/github/building-a-strong-community/managing-disruptive-comments#deleting-a-comment
Also, it looks like Github doesn't support BATCH operations currently.
So, NO and NO at the moment :(

Confluence: how to create multiple pages tree from text file (markdown) via script?

I tried web search site:stackoverflow.com confluence create multiple pages tree from text file (markdown) but did not find the answer to below:
How to create multiple pages tree from text file (markdown)?
I could not find standard macro in confluence for the task too. As I understand Confluence support scripting so it should be possible in automated way. I need tree of pages created in Confluence from indent formatted file (e.g. markdown) like below:
List item
List item
List item
In Confluence, page tree contains different pages which they can be parent and child.
You can create a Parent Page via REST API. According to Atlassian documentation you can use following end point:
curl -u admin:admin -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"new page",
"space":{"key":"TST"},"body":{"storage":{"value":"<p>This is <br/> a new page</p>","representation":
"storage"}}}' http://localhost:8080/confluence/rest/api/content/ | python -mjson.tool
In same documentation, it shows how you can create child page:
curl -u admin:admin -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"new page",
"ancestors":[{"id":456}], "space":{"key":"TST"},"body":{"storage":{"value":
"<p>This is a new page</p>","representation":"storage"}}}'
http://localhost:8080/confluence/rest/api/content/ | python -mjson.tool
Thus, you can create different pages via REST api and decide which one need to be parent and which one should be a child page. You just have to feed the endpoint with the content of your text file with the preferred language.

Github API to get the author/committer of specific line of code

I'm using Github code search API to get search for some text in a given repository. The response doesn't seem to contain any information related to the content that matched, sha/hash of the commit or the author/committer info:
https://api.github.com/search/code?q=addClass+repo:jquery/jquery
Is there any way to get the author/committer of the given line of code in a repo using the Github API?
Thanks!
For searching commits we can use the new Commit Search API which is currently available for developers for preview . During the preview period we need to explicitly specify a custom media type in the 'Accept' header. For example your search using this API could be - curl -H 'Accept: application/vnd.github.cloak-preview' \https://api.github.com/search/commits?q=addClass+repo:jquery/jquery
. ref: Search Commits

How to create a child page in Confluence by copying an existing page and using the REST API

I use the following code to create a child page under an existing parent:
curl -v -u admin:password -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"Created by API", "ancestors":[{"id":97585021}], "space":{"key":"Some_Key"},"body":{"storage":{"value":"<p>This is a test page created by API. Pls ignore</p>","representation":"storage"}}}' https://confluence.ges.symantec.com/rest/api/content/ | python -mjson.tool.
Using this I'm successfully able to create a child page under the parent content id 97585021.
What I would like to do next is: create a page under the parent id 97585021 using another page that acts as a template. The template page is in Confluence under the same content id 97585021. So I would like all pages to be created as a copy of this page.
How can I achieve this?
First step, simply get the page body content of your template in Confluence:
https://confluence.ges.symantec.com/rest/api/content/1234?expand=body.storage
Ref.: https://docs.atlassian.com/confluence/REST/latest/#content-getContentById
With the extracted body content, make some modifications if necessary, and finally create your child page by doing the exact same request you did.