What is my Gitlab domain for making API calls? - gitlab-api

I feel reaaally silly for asking this but how do I know what my Gitlab domain is when all my projects are on Gitlab.com? Lets say, I want to do an API call to get all my projects - which is done like this according to the docs:
curl --header "PRIVATE-TOKEN: XXXX" "https://gitlab.example.com/api/v4/projects"
I tried replacing example with my username and also tried specifying the target as https://gitlab.com/username/api/v4/projects but this doesn't work.
Any help is greatly appreciated.

Its actually just:
https://gitlab.com/api/v4/projects
Your private token will be used to figure out who you are and what projects you can access.

Related

Could someone give me a url that uses POST method?

I am writing a http proxy and I need to test if it can handle POST requests, but I can not find a URL that uses POST method.
Could someone give me one?
Thanks.
Try this one: http://ptsv2.com/
Read the instructions on the page. To help you further, I suggest that you use Postman, (it doesn't answer requests but is a great tool to help you compose your requests)
Also you need to show that you've done some research first. Or your question will get downvoted to hell.

Acess Issue on Jira/Atlassian with R

I got a Atlassian/Jira account where projects are listed on. I would like to import the various issues in order to make some extra analysis. I found a way to connect to Atlassian/Jira and to import what I want on Python:
from jira import JIRA
import os
impot sys
options = {'server': 'https://xxxxxxxx.atlassian.net'}
jira = JIRA(options, basic_auth=('admin_email', 'admin_password'))
issues_in_proj = jira.search_issues('project=project_ID')
It works very well but I would like to make the same thing in R. Is it possible ? I found the RJIRA package but there are three problems for me:
It's still on a dev version
I am unable to install it as the DESCRIPTION file is "malformed".
It's based on a jira server URL: "https://JIRAServer:port/rest/api/" and I have a xxxxx.atlassian.net URL
I also found out that there are curl queries :
curl -u username:password -X GET -H 'Content-Type: application/json'
"http://jiraServer/rest/api/2/search?jql=created%20>%3D%202015-11-18"
but again it is based on a "https://JIRAServer:port/rest/api/" form and in addition I am using windows.
Do someone have an idea ?
Thank you !
The "https://JIRAServer:port/rest/api/" form is the Jira REST API https://docs.atlassian.com/jira/REST/latest/
As a rest api, it just makes http method calls and gives you data.
All jira instances should expose the rest api, just point your browser to your jira domain like this:
https://xxxxx.atlassian.net/rest/api/2/field
and you will see all the fields you have access to, for example
This means you can use php, java or a simple curl call from linux to get your jira data. I have not used RJIRA but if you dont want to use it, you can still use R (which I have not used) and make an HTTP call to the rest api.
These two links on my blog might give you more insight:
http://javamemento.blogspot.no/2016/06/rest-api-calls-with-resttemplate.html
http://javamemento.blogspot.no/2016/05/jira-confluence-3.html
Good luck :)

How to include or wrap the file or file content or file object when using Softlayer Object Storage REST API

I am using Softlayer Object Storage REST API.
I was told that below command line using CURL has been successful.
$ curl -i -XPUT -H "X-Auth-Token: AUTH_tkabcd" --data-binary "Created for testing REST client" https://dal05.objectstorage.softlayer.net/v1/AUTH_abcd/container2/file10.txt
I wish to upload files using Javascript so I have no clue how do I wrap the file in my request.
Anyone please provide an example? A lot of thanks.
Here some ideas and examples that can help you:
CORS
How to consume a RESTful service using
jQuery
JavaScript REST client Library
[closed]
https://ricardo147.files.wordpress.com/2012/08/image001.png
However, there is a customer who was not able to make rest request through Javascript. I will investigate about it, I will let you know any news.
(Softlayer, Open Stack Swift) How to solve cross domain origin with
object storage
api?

apigee "Subject does not have permission" to get logged in user

Code that was previously working to get the logged in user is now failing. For the default role I have a few permissions including this one (in the list at /roles/xxx/permissions):
"get:/users/me"
To verify I didn't break something in the API, I logged in from Curl (names modified to protect the guilty):
curl -X POST "https://api.usergrid.com/xxx/xxx/token" -d '{"grant_type":"password", "username":"test", "password":"xxx"}'
This gets a valid response with an access token:
{"access_token":"YWMxxxNnAHCEeSEEUF6k0-adAAAAUcaO_3R5IcK1ftFnDt0x52NVSoHEATWD6Q","expires_in":604800,"user":{"uuid":"a2517xxx-d3dc-11e3-b4fb-17caf255a670","type":"user","name":"Test User","created":1399243032076,"modified":1399243032076,"username":"test","email":"test#test.com","activated":true,"picture":"http://www.gravatar.com/avatar/b64xxx217b34b1e8d3bd915fc65c4452"}}
Using this access token, compose the Curl request to get /users/me:
curl -X GET https://api.usergrid.com/xxx/xxx/users/me?access_token=YWMxxxNnAHCEeSEEUF6k0-adAAAAUcaO_3R5IcK1ftFnDt0x52NVSoHEATWD6Q
Now instead of working as I believe it used to, I get this:
{"error":"unauthorized","timestamp":1404289792782,"duration":0,"exception":"org.apache.shiro.authz.UnauthorizedException","error_description":"Subject does not have permission [applications:get:d5e9e5a0-d310-11e3-a524-df009e0fbc2f:/users/a25174ca-d3dc-11e3-b4fb-17caf255a670]"}
Have I broken something and just missing it? I tried deleting the permission and recreating it but that didn't help either. Thanks!
To my knowledge, you cannot use 'me' as the entity to retrieve self. You would need to specify the actually username or uuid of the user entity. Luckily when you retrieve a token, that info is passed back in the response, so you can save it.
See getting a user in the Apigee docs.
#remus question prompted me to find an example on the security page to show where I had gotten the permission from. However, the page http://apigee.com/docs/app-services/content/managing-access-defining-permission-rules now shows this example:
GET,PUT,POST,DELETE:/users/me/**
I'm fairly certain that wasn't the case earlier as this code had been working for weeks with the prior permission. Maybe I bumped my head :-) hopefully anyone else having this problem will find this. The curl examples posted in the question now work fine with this permission set (although I only added GET permission in my case).

Not ablle to receive token from OAuth authentication in Apigee tool

I have created AccessTokenClientCredential and RefreshAccessToken in OAuth proxy through Apigee tool.
When I tried to access "https://damuorgn-prod.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials&client_id=07VoDotbGhyl3aG8GxjkyXivoTNH9oiQ&client_secret=fb8ZOrAUUSGp3FAv" URL after mentioning client Id and client secret ID, page is empty. It does not displays any error or displays with Token value.
Steps followed to create token from below URL
"http://apigee.com/docs/gateway-services/content/secure-calls-your-api-through-oauth-20-client-credentials".
Please advise.
Regards,
Damodaran
I tried both Test and Prod environment but there was no luck.
I have requested for Curl software installation. Is there any other way to test this URL without Curl software. Your immediate reply is appreciated. Thanks!
Curl https://damuorgn-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials -X POST -d 'client_id=qnYUqb6j3uGraRAh7JF9d651nUXNwMCC&client_secret=mjHIFMcTDCa3YQ6f'
Could you please check on this link from Curl software ?
It looks like there may be a couple of issues:
When I try your URL, I get a "CLASSIFICATION_FAILURE" error - which means the proxy can't be found. I noticed that you're using "damuorgn-prod.apigee.net" when you might have deployed your proxy to the test environment, and meant to use: "damuorgn-test.apigee.net".
In step 5.2 of the document you referenced, it says to use POST instead of GET. So you might try this:
curl https://damuorgn-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials -X POST -d 'client_id=07VoDotbGhyl3aG8GxjkyXivoTNH9oiQ&client_secret=fb8ZOrAUUSGp3FAv'
(When I try this, I get an "invalid client id" error, but maybe that client_id is no longer valid?)
Hope that helps,
Scott

Resources