Programmatically Configure aws-iot button - react-native

i'm trying to create an RN APP and i want to know if there is any way to programatically configure AWS IOT button?.
http://docs.aws.amazon.com/iot/latest/developerguide/configure-iot.html
App is already connecting to Button ConfigureMe - XXX network.
The next step is configuring the button, i want to configure the button without the user opening the browser to 192.168.0.1/index.html
i want to build some ajax request to 192.168.0.1/configure passing the form data it needs.
wifi_ssid
wifi_password
aws_iot_certificate
aws_iot_private_key
endpoint_region
endpoint_subdomain
i can see the action endpoint from network console 192.168.0.1/configure

I was able to do this with a curl command in Linux. First you need the body of multipart/form-data. You could get it from the browser console after you click Configure button. Once you have the body, just run this, where $BOUNDARY is from the body text.
curl \
-X POST \
-H "Content-Type: multipart/form-data; boundary=$BOUNDARY" \
-F file=#body.txt \
http://192.168.0.1/configure
I'm still trying to make it work with Powershell via Invoke-RestMethod but still no luck

Related

Authentication for foxx APIs

I am working on ArangoDB 3.1 in stand-alone mode.
We are creating a Foxx API to authenticate the users who are accessing our database and our custom APIs. In order to activate authentication, we added the following statements in the arangod.conf file.
authentication = true
authentication-system-only = true
We created a user in arangosh for the database we are working on. When we log into the web console the username and password worked and we are able to access the database,APIs and also able to create users using the APIs.
But when we try to access using another browser or using curl command we are not able to see the user information. HTTP and curl commands are given below.
http://username:password#ip-address:portno/_db/AdtheorentDB/test-app/whoami
curl --basic --user "username:password" -X GET --header 'Accept: application/json' 'http://ip-address:portno/_db/databasename/test-app/whoami'
What might be the issue ?
The above curl command is obtained from the link given below.
ArangoDB authentication via HTTP

autoregister new teamcity build agent via API

We use Ansible to configure build agent for different technology stacks like: frontend builder(Nodejs, libs, Dart SDK), backend builder(JDK), etc with Ansible orchestration tool and that easy to replace one linux with another be configuring new one from zero with orchestration except new teamcity agent registration.
Is it piossible to generate new authorizationToken for new agent with API call which can be used in programming language or register new agent via API call to be able to connect new linux box without Admin/human ?
There's REST API call to achieve this, just pass true or false string as request data via PUT request to the /httpAuth/app/rest/agents/<agentLocator>/authorized, <agentLocator> syntax is described here.
Here's an example of a curl command:
curl -X PUT "http://teamcity/httpAuth/app/rest/agents/id:3/authorized" --data true --header "Content-Type: text/plain" -u user:pass
PUT method should be used and Content-Type: text/plain header should be provided.

Confluence REST API Authorization Failure

I am trying to use the Confluence REST API to create a page. I am using the curl example off of the documentation found HERE. Every time I try to run a terminal command using this curl I get a response that says 'HTTP Status 401 - Basic Authentication Failure - Reason : AUTHENTICATION_DENIED'. I see that someone else had a similar issue regarding their C# code, but there was never a resolution given. Hopefully someone with experience will be able to tell me what I am doing wrong. My curl is listed below with the sensitive parts replaced in <> format.
curl -u <USER>:<PASSWORD> -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","space":{"key":"<PAGEKEY>"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' https://<SERVER>/wiki/confluence/rest/api/content/ | python -mjson.tool
I was finally able to resolve this. Through a combination of the answer here How to create new page in Confluence using their REST API? and using a login that had the appropriate permissions.

Create an ajax call

i've never used an ajax call,can anybody suggest me to create a jquery ajax call using this api (parse.com),what is H,G?:
curl -X GET \
-H "X-Parse-Application-Id: qS0KLMx5h9lFLGJIpj9qyhM9EEPiTS3VMk" \
-H "X-Parse-REST-API-Key: nh3eoUo9GF2gMhcKJIfIt1Gm" \
-G \
--data-urlencode 'username=cooldude6' \
--data-urlencode 'password=p_n7!-e8' \
https://api.parse.com/1/login
curl is a tool for sending HTTP requests. The -H flag sets a header and -G specifies that the data should be transmitted as a URL query parameter rather than content body. In this case, your command sends an HTTP GET command with the custom headers "X-Parse-Application-Id" and "X-Parse-REST-API-Key". This request was sent to https://api.parse.com/1/login?username=cooldude6&password=p_n7!-e8.
You don't need to become a CURL expert to use Parse; the REST API helps you understand how the Parse API works across the wire, but there are both first and third party APIs for just about every language you would need.
P.S. The Parse docs page helps you by pre-filling the value of X-Parse-Application-Id and X-Parse-REST-API-Key with keys from your actual app. By posting these keys online, others can write code that will look like your app to Parse. Though best practices would suggest you secure your app so that it's OK for these keys to leak (e.g. by setting class-level permissions), you may consider deleting & recreating a new app since it sounds like you are just starting development.

filepicker save image back to the s3 bucket

I have used the image editor demo in my site which works great.
The issues I am having is when it comes to saving back. I want to save it back to filepicker without any user input (not use filepicker.saveas function) but it does not work. I tried the curl call as specified in the docs
curl -X POST -d #filename.txt --header "Content-Type:text/plain" https://www.filepicker.io/api/file/gNw4qZUbRaKIhpy-f-b9
but just get a generic error from the system.
got it working I left the url= into the source image