I am trying to get a list of GitHub Repo names for my organisation.
Using Postman I have used:
GET https://api.github.com/orgs/ORGNAME/repos
This responds with all of the data for each repo. Is there a way to just return the repo names?
Thanks!
It's not possible with the REST API. You need to use their GraphQL API to fetch specific fields.
With the REST Api you will always get the full dataset, but with Graphql you can query your way around to fetch only what you need. here is a sample :
To fetch the data in graphql the method must be POST, put the base url https://api.github.com/graphql
in the body of the request select GraphQL. and add the following query in QUERY:
query MyQuery {
nodes(ids: ["#node_id"]) {
... on Organization {
repositories(first: 10) {
nodes {
name
}
}
}
}
}
PS: replace node_id with your org node_id
in Authorization tab select TYPE Bearer Token and add your Github access token(https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
Related
I'm trying to create new SharePoint ListItem using Microsoft Graph.
To create a list item with simple fields like Title, my POST body looks like:
{
"fields":{
"Title":"Ehsan's REST"
}
}
But as soon as I add a field with the multichoice value I get The request is malformed or incorrect. error.
example:
{
"fields":{
"Title":"Ehsan's REST",
"Languages": ["English","French"]
}
}
During my search I found this forum post where SharePoint API (not Graph ) requires a metadata attribute to be added to the collection as an object:
"InternalFieldName":{
"__metadata":{"type":"Collection(Edm.String)"},
"results":["Value1","Value2","Value3"]
}
There's an open issue on microsoft graph doc github related to this as well.
Any suggestions?
You should be able to set the value of multi-choice columns, but you'd have to specify the type of the field to make sure OData understands it:
{
"fields": {
"choice_checkboxes#odata.type": "Collection(Edm.String)",
"choice_checkboxes":["cb1","cb2"]
}
}
I am able to post lookup column values using following:
"ProductsLookupId#odata.type": "Collection(Edm.Int32)",
"ProductsLookupId":[6,7,8]
Where Products is a lookup column to allow multiple choice.
I'm looking for some advice on how to approach retrieving the users from a given group of the activti-app. Having read the documentation I've attempted to hit the endpoint associated with users and their groups by a posting a JSON body containing an array of user task filter ids.
Testing this in Postman returns a 500 internal server error "exception": "Request method 'POST' not supported". Obviously this is because I should be making a GET request however I cannot attach a JSON body in that case.
Aforementioned example endpoint: localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users
Aforementioned docs:
https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_user_and_group_lists
Specifically this section Screencap of activti docs
Any suggestions would be greatly appreciated!
Thanks!
First, we have to make sure we are talking about "organization groups" not "capabilities groups". That was my original confusion. Once I create the right kind of group I could successfully use the REST API to fetch both a list of groups and a list of group members.
As the docs point out, to get a list of groups, do this:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups
Which returns:
{
"size":2,
"total":2,
"start":0,
"data":[
{"id":5,"name":"test-org-group-1","externalId":null,"status":"active","groups":null},
{"id":6,"name":"test-org-group-2","externalId":null,"status":"active","groups":null}
]
}
If you want to pass a filter, do it with "?filter=some-group-name".
Now, to see the members of a specific group, pass in the group ID, which is a numeric. So to see the members of test-org-group-1 I would use:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups/5/users
Which returns:
{
"size":2,
"total":2,
"start":0,
"data": [
{"id":2,"firstName":"Test","lastName":"User1","email":"tuser1#metaversant.com"},
{"id":3,"firstName":"Test","lastName":"User2","email":"tuser2#metaversant.com"}
]
}
i am working with dynamodb to insert and retrieve records from dynamo. please note that when i insert the record to dynamo db it is working fine but when i try to list any item or retrieve any item from dynamodb it return no result found
for retrieving of record
created a iam role which has trust relationship with api gateway. and has managed policies : AmazonAPIGatewayInvokeFullAccess , AmazonDynamoDBFullAccess , APIGatewayAWSProxyExecPolicy , AmazonAPIGatewayAdministrator.
created a table named, emp which has the field ID and name.
created an api gateway named emp, which has resource /employee. and has method post and get. post for insert and get for display record.
for get method selected aws service proxy
then in URL Query String Parameters added id in method request.
then also in integration request > URL Query String Parameters added > ID and method.request.querystring.id.
in integration request > body mapping template added application/json and then the json code
{
"TableName": "emp",
"KeyConditionExpression": "ID = :v1",
"ExpressionAttributeValues": {
":v1": {
"S": "$input.params('ID')"
}
}
}
then when i tested it it returns no result I cannot figure out why please help.
I'm not an expert on this, but I can see two issues.
First in the DynamoDB service proxy settings the HTTP method needs to be POST, as you are POSTing a request to DynamoDB API, and it has nothing to do with the the fact the you use the GetItem method.
Second, your body mapping template uses KeyconditionExpression that is used in DynamoDB Query API, but not in the GetItem. GetItem needs a Key specified, like here: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html#API_GetItem_Examples
Hope this helps.
How to insert post data into database using flowgear API? I am done inserting data using get but html form post method is not work using flowgear API. Please explain how it is acheive in flowgrear.
I have this URL
http://www.somedomain.com/api/flow-test
When I hit enter it is return JSON value
{
"message" : "message send successfully",
"statusCode" : "1"
}
This JSON value store into database using flowgear post method.
If you want to POST some data to a Flowgear API endpoint and then ingest that into a database, add the special property FgRequestBody on to a Variable Bar to receive the POST data.
If it's in JSON format, use JSON Convert to convert it to XML, then push it through a transform (XSL Transform or QuickMap) if it's layout doesn't match your target database.
Finally, use an SQL Table Update to insert to the data into the database.
When calling a Flowgear Workflow using an API call, the Workflow can respond with a specific body using the FgResponseBody and FgResponseContentType variables on the Variable Bar.
I am using the library go-json-rest. I'm trying to recognize queries parameters in the code for example localhost:8080/reminders?hello=world I want to access {hello: world} . I have the following code:
//in another function
&rest.Route{"GET", "/reminders", i.GetAllReminders},
func (i *Impl) GetAllReminders(w rest.ResponseWriter, r *rest.Request) {
reminders := []Reminder{}
i.DB.Find(&reminders)
w.WriteJson(&reminders)
}
I know that r.PathParams holds the url parameters but I cannot seem to find how to the query parameters past the "?" in the url.
Given that go-json-rest is a thin wrapper on top of net/http, have you looked at that package's documentation? Specifically, the Request object has a field Form that contains a parsed map of query string values as well as POST data, that you can access as a url.Values (map[string][]string), or retrieve one in particular from FormValue.