How can I retrieve a gitlab issue by its id? - gitlab-api

I am trying to track a GitLab issue no matter in what project it may reside.
An issue is normally created in GitLab within the context of a project. If it is moved to another project, the issue is closed and a new issue is created. The original issue tracks the new location using the moved_to_id. The problem is I have no idea how to follow this moved_to_id value using the GitLab API v4. GitLab does not honour the typical REST-like behaviour where you can retrieve an entity by its ID.
For example, if I call https://gitlab.com/api/v4/issues/ I'll get a list of issues as objects: these objects have a set of fields: title, description, state, ..., id and iid. The iid is the user-friendly id of an issue within a project. But what is the id and how is it useful? I can't retrieve an issue using this id - at least not using expected ways...
Consider an issue exists in https://gitlab.com/api/v4/issues/ with id == 29564819,
https://gitlab.com/api/v4/issues/29564819 returns a 404.
https://gitlab.com/api/v4/issues/29564819/ returns a 404.
https://gitlab.com/api/v4/issues/29564819?scope=all returns a 404
https://gitlab.com/api/v4/issues/?id=29564819 returns all the issues (no effect using parameter).
Can I retrieve an issue without a project? Do I have to resort to using labels?

If a user is not a member of a private project, a GET request on that project results in a 404 status code.
Only administrators can retrieve issue by its id.
The preferred way to do this is by using personal access tokens.
GET /issues/:id

Related

Store and alter single variable on vercel serverless functions

For a client I am building a static website rendered with nextjs and deployed on vercel. Everything on this website is static, so I don't need any database. However, this client wants to use the instagram API to show a gallery of their photos on two of their pages. This is with a custom design, so I can't use any embed code, but to the best of my knowledge I have to use the Instagram basic display API
To the problem at hand: I was wondering if there is some way to store a single variable without creating a whole database for it in vercel. I know I can use Environment Variables, but the problem is that the instagram api needs to change the access token every 2 months. To renew the access token for instagram, I was planning to write a CRON job that runs about every month to update this value.
I was wondering if it is possible to somehow store this single value on the deployed site without creating a database just for this single value. For example, is it somehow possible to change an environment variable from within a serverless function?
Any help in the right direction is appreciated!
Thanks
You go to Vercel: settings-> environment variables -> add your variable. In this variable you can store your Instagram API variable and in the code you use process.env.{variable}
Example:
you defined name of variable as instagramAPI in your local files (next.config.js or .env.local)
module.exports = {
env:{
instagramAPI : 'https://instagramapiexample.com'
},
}
you define instagramAPI (exactly the same name of the variable as in the code) on your vercel settings
In your code (local files) you call process.env.instagramAPI variable to have the value of the string.
Your code works as expected.
!IMPORTANT! if you have some secrets or passwords in your process.env.variables you newer saves it in next.config.js. For this purpose you saves your instagramAPI to .env.local (described in point 1). More info here

Unable to get the edge access token

I have created a new mimik developer account, and I was trying get the edge access token using the command "mimik-edge-cli account get-edge-access-token -t <--id token-->". But I am getting an "Error" as response.
I have tried with my previous account and in that case i am able to get the access token as shown below. Same issue happened for raspberrypi too.
why it is not able to get the access token while using a new account?
Please make sure to copy the ID Token from developer portal correctly, In most cases there might be a hidden character copied. Maybe just try copying the text by highlighting with mouse from first character to the last. Do NOT use the copy to clipboard button. Also please make sure that the edgeEngine on the PI is not associated already by checking with:
mimik-edge-cli account get-me
When you input command above, if you see an ID for value "accountId:" then your PI is already associated an CANNOT be associated again. You have to un-associate first and then associate with the new ID token from new account/project. You can verify that un-association is successful when above command shows empty value for "accountId:"
FOR FUTURE REFERENCE:
Please only tag questions with edgeSDK if it is related to FreeRTOS platform. For all other platforms, please use tag edgeEngine

Type query_root must define one or more fields

First, thanks Hasura for incredible good product! I love it.
I have issue with derive action with Hasura Console. My use case:
I enable anonymous role for subscribe function (everybody can send email to subscribe)
I have configured permission on my subscribe table, everything is fine.
I want to validate the user input on server side, for example, validate email format. I have followed by this guide about derive action. I found no mistake here.
But I got the error "Type query_root must define one or more fields." when I hit "Derive action" at the first time.
According to this question, as I understand, I need to have object type for root query.
Of course, I will have object type for root query eventually. I can work around by giving some dummy queries for anonymous role. But I do not like that cheat anyway.
Any idea on that? Any help will be highly appreciated.
Edited:
My related current version:
Hasura 1.3.2
One click deployment using Docker on Digital Ocean.

Simulating CMIS Atom API doesn't load the information properly

I was requested to simulate a CMIS Atom API for my company's content management using our API. but I'm stuck in what it seems to be something simple. So I'm trying to load the CMIS TCK, but for some reason the values of the responses doesn't make it into the next request. So I think I'm missing something.
The first request I get is to getRepositories
/cmisatom/getRepositories
Then I get the request to get a specific repository
/cmisatom/getRepositories?repositoryId=c9ad76c6-d121-4a32-bb14-e5d43bf91ee6
Which kinda tells me that the data from the first request was parsed properly.
Now on the third request is where things get weird. I get the request for the id
/cmisatom/c9ad76c6-d121-4a32-bb14-e5d43bf91ee6/id?id=&filter=&includeAllowableActions=&includeACL=&includePolicyIds=&includeRelationships=&renditionFilter=
but no information of the id, not filter nor anything else, was loaded. I'm matching the responses to a alfresco CMIS Atom that I have running on my local. So the response its identical except for the jsession. Can you share any guidance on this?
The steps go like below.
Service document is the first one to fetch - your example refers to it as "/cmisatom/getRepositories". This lists the list of all repository data. It also includes the repository url templates like OBJECT_BY_ID, TYPE_BY_ID etc. That means, for navigation / listing folders etc, your link "/cmisatom/getRepositories?id=c9ad76c6-d121-4a32-bb14-e5d43bf91ee6" is not used.
The third link you're referring to looks like a URL template OBJECT_BY_ID - and here you have to provide the object id and populate other params before you make a request.
The param object id for the first request is again a value which you obtain from service document. This value is called ROOT FOLDER ID.
Use root folder id to update object by id url template and get the root folder details - from there you get the children and proceed further.
You can refer further to Apache Chemistry In Memory repository - https://chemistry.apache.org/java/developing/repositories/dev-repositories-inmemory.html - it is an open source implementation which can help you dig deep.
And this is the spec: http://docs.oasis-open.org/cmis/CMIS/v1.1/CMIS-v1.1.html

basic firebase URL structure?

I am building a very simple cron job backup system for a friend's firebase app;
I have PHP code, using firebase-php that can communicate with the firebase and the API docs state that adding the'?format=export" parameter will retrieve a .json file. Cool, so far.
My question is this: What path (after the firebase URL) is required?
The API doc appears to state that it should be /.json but it returns a 404 /json/ works on the simulator, but also returns a 404 in testing
(note: looking for a single text file, similar to the "Export json" data dashboard, if possible)
Thanks in advance.
The path defined the portion of the Firebase data tree that is being loaded. That means that you can load /any/possible/string and it will return a value, though that value is likely to be null unless you've written data to that path. Also note that without a defined extension (i.e. .json) you'll be attempting to load Firebase's in-browser graphical debugger.
In short, if you're using the REST API, you'll always want to end your paths in .json, but nothing else is required, i.e. https://<your-firebase>.firebaseio.com/.json is perfectly valid, and would download your entire Firebase. The format=export parameter ensures that any Firebase priority values are preserved in your JSON output, under the key .priority at any node, where they would normally be excluded.

Resources