Can't post in a specific Yammer's group - rest

I'm doing a curl to send a POST in my group, and it doesn't works, it posts on the All Company Network even if I sent the group_id.
curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer OAUTHTOKENHERE" -X POST -d '{"activity":{"actor":{"email":"MYEMAIL"},"action":"create"}}' https://www.yammer.com/api/v1/messages.json?body=TestingfromYammersAPI&group_id=GROUPID
I'm writing the right group_id, and still not reading that argument.
Does anyone has this problem too?
Yammer's API docs:
https://developer.yammer.com/docs/messages-json-post

The problem was that I wasn't quoting the URL -___-
Working code:
curl -H 'accept: application/json' -H 'authorization: Bearer OAUTHTOKENHERE' -H 'content-type: application/json' -X POST -d ' ' 'https://www.yammer.com/api/v1/messages.json?body=MESSAGE_HERE&group_id=GROUP_ID'

Related

Adding filter with curl for github api

How do i add the 2fa filter in curl for the github api?Here is an image of the documentation page, however it does not specify how to add the filter for 2fa.
Thanks so much!
I have tried using a "?":
curl
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer """
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/orgs/"my_org_name"/members?2fa_disabled
According to the documentation, the query-parameter you need is called filter with the value 2fa_disabled. Therefore your curl command should look the following:
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/members?filter=2fa_disabled
Keep in mind that this options is only available for organization owners.
Documentation: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#list-organization-members

Geoserver: REST create WMTSLayers

Under Geoserver, How do we create the WMTSLayer once the WMTSStore is establish via REST API ?
Trying to follow the swagger documentation under here,
https://docs.geoserver.org/latest/en/api/#1.0.0/layers.yaml
But can't find the correct url to work for it. Get 404 when I try this using curl
curl -v -u admin:geoserver -X POST http://localhost:8085/geoserver-cloud/rest/workspaces/{workspaceName}/wmtsstores/{wmststoreName}/wmtslayers -H "accept: application/json" -H "content-type: application/json" -d "{\"featureType\":{\"name\":\"World_Imagery\"}}"
Also looked under here,
https://docs.geoserver.org/latest/en/api/#1.0.0/wmtslayers.yaml
And tried below url for it. Get 500 when I try this using curl
curl -v -u admin:geoserver -X POST http://localhost:8085/geoserver-cloud/rest/workspaces/{workspace}/wmtsstores/{wmtsstore}/layers -H "accept: application/json" -H "content-type: application/json" -d "{\"featureType\":{\"name\":\"World_Imagery\"}}"
Found it, need to pass wmtsLayer
curl -v -u admin:geoserver -X POST http://localhost:8085/geoserver-cloud/rest/workspaces/{workspace}/wmtsstores/{wmtsstore}/layers -H "accept: application/json" -H "content-type: application/json" -d "{ \"wmtsLayer\": { \"name\": \"NatGeo_World_Map\" } }"

How to you insert a confluence macro into a page created by the Confluence Rest Api? Or how to create a page with macro Attachment?

Confluence 6.15.2
I need to insert a macro into an existing page using the REST API.
curl -s -u user:pasw -X POST -H 'Content-Type: application/json'
'-d{"id":"246341155",
"type":"page",
"space":{"key":"TST"},
"body":{"value":"<ac:structured-macro ac:name="attachments"><ac:parameter ac:name="old">false</ac:parameter><ac:parameter ac:name="sortBy">name</ac:parameter><ac:parameter ac:name="upload">true</ac:parameter></ac:structured-macro>","representation":"storage"}}'
https://localhost:8080/rest/api/content/
The response:
{"statusCode":500,"message":"","reason":"Internal Server Error"}
When creating a page with a macro, the same error occurs, the page is not created:
curl -s -u user:pasw -X POST -H 'Content-Type: application/json' -H 'Accept: application/json'
'-d{"type":"page",
"ancestors":[{"id":246324831}],
"title":"New Page",
"space":{"key":"TST"},
"body":{"storage":{"value":"<ac:structured-macro ac:name="attachments"><ac:parameter ac:name="old">false</ac:parameter><ac:parameter ac:name="sortBy">name</ac:parameter><ac:parameter ac:name="upload">true</ac:parameter></ac:structured-macro>",
"representation":"storage"}}}'
'https://localhost:8080/rest/api/content/?os_authType=basic'
Create new page with macro attachment:
curl -s -u user:pasw -X POST
-H 'Content-Type: application/json' -H 'Accept: application/json'
'-d{"type":"page","ancestors":[{"id":**<parent ID>**}],
"title":"New page with macro attach","space":{"key":"TST"},
"body":{"storage":{"value":"<p><ac:structured-macro ac:name=\"attachments\" ac:schema-version=\"1\"><ac:parameter ac:name=\"old\">false</ac:parameter><ac:parameter ac:name=\"sortBy\">name</ac:parameter></ac:structured-macro></p>","representation":"storage"}}}'
'https://localhost:8080/rest/api/content/?os_authType=basic'
Insert into page marco attachment:
curl -s -u user:pasw -X PUT
-H 'Content-Type: application/json'
'-d{"version":{"number":**"2"**},
"title":"Test page for insert macro",
"type":"page",
"body":{"storage":{"value":"<p><ac:structured-macro ac:name=\"attachments\" ac:schema-version=\"1\"><ac:parameter ac:name=\"old\">false</ac:parameter><ac:parameter ac:name=\"sortBy\">name</ac:parameter></ac:structured-macro></p>","representation":"storage"}}}'
https://localhost:8080/rest/api/content/**<cuurent page ID>**

Request to VSTS REST API only works on Postman

I'm trying to run this request
curl -X POST \
'https://*****.visualstudio.com/DefaultCollection/_apis/wit/wiql?=&api-version=1.0' \
-H 'authorization: Basic *****' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: *****' \
-d '{
"query": "SELECT [System.Id] FROM WorkItems"
}'
but I keep getting this error
{"count":1,"value":{"Message":"A value is required but was not present in the request.\r\n"}}
It works as expected on Postman, so I think the request and the server are OK.
I'm trying to follow the first example shown here: https://www.visualstudio.com/en-us/docs/integrate/api/wit/wiql
Am I missing something?
The URL is wrong, remove =& from the REST API url and the url will be like this:
https://*****.visualstudio.com/DefaultCollection/_apis/wit/wiql?api-version=1.

How to use Curl to invoke a Temboo API?

How can I use curl to invoke a Temboo API? I want to get a list of all Temboo APIs.
Below is the Curl example given on a Temboo Rest API webpage. I'm not sure how to change it for correct access.
curl -k --basic -u user#temboo.com:test1234 --header "Accept: application/xml" --header "Content-Type: application/xml" --header "x-temboo-domain: /myOrg/master" https://myOrg.temboolive.com:443/temboo-api/1.0/choreos
Changes:
Change user#temboo.com:test1234 to the email address and password on file at Temboo. e.g. toto#totomail.com:totopassword
Change all instances of myOrg to your Temboo account name. e.g. toto.
curl -k --basic -u toto#totomail.com:totopassword --header "Accept: application/xml" --header "Content-Type: application/xml" --header "x-temboo-domain: /toto/master" https://toto.temboolive.com:443/temboo-api/1.0/choreos