I'm using octokit (https://octokit.github.io/rest.js/v18#projects-list-cards) to interact with my Project and Issues in my repo. I have the project_cards in a list, but I'd like to make some changes to the labels on the issue when I move from column to column.
As near as I can tell (https://docs.github.com/en/rest/reference/projects#list-project-cards), the only way to get the issue number is to manually parse the content_url field:
[
{
"url": "https://api.github.com/projects/columns/cards/1478",
"id": 1478,
"node_id": "MDExOlByb2plY3RDYXJkMTQ3OA==",
"note": "Add payload for delete Project column",
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2016-09-05T14:21:06Z",
"updated_at": "2016-09-05T14:20:22Z",
"archived": false,
"column_url": "https://api.github.com/projects/columns/367",
"content_url": "https://api.github.com/repos/api-playground/projects-test/issues/3",
"project_url": "https://api.github.com/projects/120"
}
]
This seems pretty surprising to me, am i missing something? I'm just looking to figure out what the underlying issue number is so that I can do some manipulation of the labels.
Related
if anyone can help me with my problem thank you, i will explain better.
I am trying to remove the browser bar from the top of my TWA, I have tried several things I read on the internet but so far nothing.
I already created the file "assetlinks.json" with my two fingerprints, both the app signature and the upload signature.
And yet the browser bar appears at the top of my application.
Here is the link to my "assetlinks.json":
https://app.planetspay.com.br/.well-known/assetlinks.json
Follow my application's link on Google Play:
https://play.google.com/store/apps/details?id=app.planetsplay.com.br
Here is my TWA-manifest.json file:
{
"packageId": "app.planetsplay.com.br",
"host": "app.planetspay.com.br",
"name": "PlanetsPay",
"launcherName": "PlanetsPay",
"display": "standalone",
"themeColor": "#16A591",
"navigationColor": "#16A591",
"navigationColorDark": "#16A591",
"navigationDividerColor": "#16A591",
"navigationDividerColorDark": "#16A591",
"backgroundColor": "#FFFFFF",
"enableNotifications": true,
"startUrl": "/logar?ref=twa",
"iconUrl": "https://app.planetspay.com.br/img/icone-app.png",
"splashScreenFadeOutDuration": 0,
"signingKey": {
"path": "F:\\RubensFlinco-PC\\Documents\\Github\\PlanetsPay-Aplicativo\\android.keystore",
"alias": "android"
},
"appVersionName": "2",
"appVersionCode": 2,
"shortcuts": [
{
"name": "Meu QRCode",
"shortName": "QRCode",
"url": "https://app.planetspay.com.br/qrcode?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/qrcode.png"
},
{
"name": "Emitir cobrança",
"shortName": "Cobrar",
"url": "https://app.planetspay.com.br/pessoal/cobrar?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/cobrar.png"
},
{
"name": "Transferir dinheiro",
"shortName": "Transferir",
"url": "https://app.planetspay.com.br/pessoal/dinheiro/transferir?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/transferir.png"
},
{
"name": "Ver meu extrato",
"shortName": "Extrato",
"url": "https://app.planetspay.com.br/pessoal/extrato?twa=true&utm_source=shortcuts",
"chosenIconUrl": "https://app.planetspay.com.br/img/icons/extrato.png"
}
],
"generatorApp": "bubblewrap-cli",
"webManifestUrl": "https://app.planetspay.com.br/manifest.json",
"fallbackType": "customtabs",
"features": {},
"alphaDependencies": {
"enabled": false
},
"enableSiteSettingsShortcut": false,
"isChromeOSOnly": false,
"orientation": "portrait",
"fingerprints": [],
"appVersion": "2"
}
I discovered that it was my typo in the package name
I could get the project, but it does not retrieve the Social Preview of the project:
The link that I'm using is this one:
https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD
which is returning the following:
{
"id": 215636067,
"node_id": "MDEwOlJlcG9zaXRvcnkyMTU2MzYwNjc=",
"name": "BCMIC-PHD",
"full_name": "AngelRibeiro10/BCMIC-PHD",
"private": false,
"owner": {
"login": "AngelRibeiro10",
"id": 13433634,
"node_id": "MDQ6VXNlcjEzNDMzNjM0",
"avatar_url": "https://avatars2.githubusercontent.com/u/13433634?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/AngelRibeiro10",
"html_url": "https://github.com/AngelRibeiro10",
"followers_url": "https://api.github.com/users/AngelRibeiro10/followers",
"following_url": "https://api.github.com/users/AngelRibeiro10/following{/other_user}",
"gists_url": "https://api.github.com/users/AngelRibeiro10/gists{/gist_id}",
"starred_url": "https://api.github.com/users/AngelRibeiro10/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/AngelRibeiro10/subscriptions",
"organizations_url": "https://api.github.com/users/AngelRibeiro10/orgs",
"repos_url": "https://api.github.com/users/AngelRibeiro10/repos",
"events_url": "https://api.github.com/users/AngelRibeiro10/events{/privacy}",
"received_events_url": "https://api.github.com/users/AngelRibeiro10/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/AngelRibeiro10/BCMIC-PHD",
"description": "This is a Brain-Computer Music Interfacing Project",
"fork": false,
"url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD",
"forks_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/forks",
"keys_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/teams",
"hooks_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/hooks",
"issue_events_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/issues/events{/number}",
"events_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/events",
"assignees_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/assignees{/user}",
"branches_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/branches{/branch}",
"tags_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/tags",
"blobs_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/statuses/{sha}",
"languages_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/languages",
"stargazers_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/stargazers",
"contributors_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/contributors",
"subscribers_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/subscribers",
"subscription_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/subscription",
"commits_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/contents/{+path}",
"compare_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/merges",
"archive_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/downloads",
"issues_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/issues{/number}",
"pulls_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/pulls{/number}",
"milestones_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/milestones{/number}",
"notifications_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/labels{/name}",
"releases_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/releases{/id}",
"deployments_url": "https://api.github.com/repos/AngelRibeiro10/BCMIC-PHD/deployments",
"created_at": "2019-10-16T20:14:22Z",
"updated_at": "2019-11-14T16:52:13Z",
"pushed_at": "2019-11-14T16:52:11Z",
"git_url": "git://github.com/AngelRibeiro10/BCMIC-PHD.git",
"ssh_url": "git#github.com:AngelRibeiro10/BCMIC-PHD.git",
"clone_url": "https://github.com/AngelRibeiro10/BCMIC-PHD.git",
"svn_url": "https://github.com/AngelRibeiro10/BCMIC-PHD",
"homepage": null,
"size": 69612,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": {
"key": "apache-2.0",
"name": "Apache License 2.0",
"spdx_id": "Apache-2.0",
"url": "https://api.github.com/licenses/apache-2.0",
"node_id": "MDc6TGljZW5zZTI="
},
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master",
"temp_clone_token": null,
"network_count": 0,
"subscribers_count": 1
}
I want to get this picture of 'Social Preview' ... but it doent show in the returning of the project atributes.
Thank you very much :)
So it's not possible to retrieve it from the API, but in my case since I only displayed my top three repos on my website it wasn't a pain to manually grab the image URLs.
I did this by uploading the preview image on GitHub, then right click on the image when it pops up -> inspect and you'll see in the developer tools the element has a 'background-image: url()' property, right click on that URL and then open in new tab, and there's the URL for your image!
Like I said, it's a manual process but if you need to only do it a few times then it's not a huge deal. That was my workaround.
I am doing users search, but the result from GitHub does not contain all the information I need.
For example, when searching for users based in New York with request:
GET https://api.github.com/search/users?q=location:"New York"
I got back response such as:
{
"total_count": 58317,
"incomplete_results": false,
"items": [
{
"login": "ry",
"id": 80,
"node_id": "MDQ6VXNlcjgw",
"avatar_url": "https://avatars1.githubusercontent.com/u/80?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ry",
"html_url": "https://github.com/ry",
"followers_url": "https://api.github.com/users/ry/followers",
"following_url": "https://api.github.com/users/ry/following{/other_user}",
"gists_url": "https://api.github.com/users/ry/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ry/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ry/subscriptions",
"organizations_url": "https://api.github.com/users/ry/orgs",
"repos_url": "https://api.github.com/users/ry/repos",
"events_url": "https://api.github.com/users/ry/events{/privacy}",
"received_events_url": "https://api.github.com/users/ry/received_events",
"type": "User",
"site_admin": false,
"score": 1.0
},
...
]
}
I would like to get back also counts for public_repos and followers.
This info is available, when sending user query:
GET https://api.github.com/users/{login}
{
...
"public_repos": 1331,
"followers": 262,
...
}
Is there a way to extend search results with specified properties?
You can use GraphQL API v4 using the following request :
{
search(query: "location:\"New York\"", type: USER, first: 100) {
userCount
edges {
node {
... on User {
login
followers {
totalCount
}
repositories(privacy: PUBLIC) {
totalCount
}
}
}
}
}
}
Try it in the explorer
I do not want to retrieve the review's "state" ( e.g., 'open', 'closed' ) but rather the status (e.g., 'approved'). I cannot see a way to do this through the API however. It always returns an empty JSON array, regardless of the status.
For example, this _should_ return a status of "approved", but it returns nothing:
https://github.mydomain.com/api/v3/repos/myOrg/myRepo/statuses/8675309
results in:
[
]
Is this operation ('review status') not supported through the API?
You should actually be trying a different API. According to the Status API documentation of GitHub,
The status API allows external services to mark commits with an error, failure, pending, or success state, which is then reflected in pull requests involving those commits.
So the Status API provides the status of every commit as part of a PR, for eg, if the build failed or succeeded as part of the commit push. The below request would only return the statuses as part of a reference.
GET /repos/:owner/:repo/commits/:ref/statuses
What you need is the Reviews API, where you can get the reviews for a PR, which would have the state field that you are expecting. The API is
GET /repos/:owner/:repo/pulls/:number/reviews
And a sample response is
[
{
"id": 80,
"node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"body": "Here is the body for the review.",
"commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
"state": "APPROVED",
"html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",
"_links": {
"html": {
"href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"
},
"pull_request": {
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"
}
}
}
]
Note that the state field in the response has the APPROVED state that you are looking for.
More info on the same in the GitHub documentation of Reviews API.
For example, for user:django, the url I want to retrieve thru github-api is not
https://github.com/django
but
http://www.djangoproject.com/
as shown below in the red ellipse:
The user search api does not return this url in the response.
The Data that returns from the service would be as follows:
https://api.github.com/users/django
{
"public_gists": 0,
"type": "Organization",
"followers": 240,
"login": "django",
"created_at": "2008-10-06T19:43:18Z",
"html_url": "https://github.com/django",
"avatar_url": "https://secure.gravatar.com/avatar/fd542381031aa84dca86628ece84fc07?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
"company": null,
"email": null,
"blog": "http://www.djangoproject.com/",
"following": 0,
"name": "Django",
"location": "Internet",
"url": "https://api.github.com/orgs/django",
"id": 27804,
"public_repos": 49
}
As you can see, that URL is in the blog field.