sample request : curl -H "Snapdeal-Affiliate-Id:aaaaa" -H "Snapdeal-Token-Id:bbbbb" "affiliate-feeds.snapdeal.com/feed/api/category/v1:586:1461823?expiresAt=1441751400001&signature=cvtwgjgrrbozmumlaalg" -H "Accept:application/xml"
We can do this by importing this curl format in postman client. It then gives us the sample request ,its headers and body. which makes it quite easire for us to respond to curl request.
Related
I am trying to set up a integration with a REST API, that requires a Base64 encoded key to authenticate, and I cannot seem to get it to work.
The API only returns:
<Code>-4</Code><Message>Not Authenticated</Message>
"Please provide a valid username and password"
My request looks like this:
curl -i
-H 'application/json'
-X GET
-H 'basic :Base64EncodedKey'
http://se.api.anpdm.com/v1/filter/all
No username should be supplied, thats why I use : before the key.
Can someone please try to help me? I am not a developer, I am just in charge of generating code examples.
/Max
A little trick of generate your base64 encode:
echo -n admin:123456 | base64
YWRtaW46MTIzNDU2
Then use it like this:
curl -H "Authorization: Basic YWRtaW46MTIzNDU2" http://nexus.xxxxcloud.com/nexus/service/local/artifact/maven/content
The header is Authorization: Basic Base64EncodedKey. You are missing the Authorization portion in your header.
-H 'Authorization: Basic Base64EncodedKey'
This is related to PayPal's API to get user information in sandbox environment as described here - https://developer.paypal.com/docs/api/#get-user-information
curl -sk https://api.sandbox.paypal.com/v1/identity/openidconnect/userinfo/?schema=openid \
-H "Content-Type:application/json" \
-H "Authorization: Bearer <valid_access_token>"
I get a user_id in the json response, but rest of the other user attributes such as name, given_name, family_name are removed. Like so
{
"user_id": "https://www.paypal.com/webapps/auth/identity/user/eyeTNlAeNRNDMpHBW6OCUyA-d7hsvZjChNONOiujnhU"
}
How can I get rest of those attributes?
If you want to get these information, you need to select these attributes in your REST APP on developer.paypal.com site.
Is there any way to make commands to neo4j from the command line without entering the shell, in other words the equivalent of:
mysql -u user -ppassword -e "INSERT INTO something VALUES something-else"
I'd also like to be able to make commands from an executable script, something akin to:
mysql -u user -ppassword << EOF
INSERT INTO something VALUES something-else;
EOF
Does anyone know the best way to do this?
You could always use curl to post requests to the REST API.
curl --header "Content-Type: application/json" \
--request POST \
--data '{"statements" : [ { "statement" : "create (n:Node {name: \"Test\"} ) return n" } ] }' \
http://localhost:7474/db/data/transaction/commit
Here is the Neo4j REST API reference.
You can pass arguments to the neo4j-shell command :
Execute cypher passed in the command :
./bin/neo4j-shell -c 'match(n:Page) RETURN count(n);'
Or execute a cypher script file :
./bin/neo4j-shell --file your-file.cql
I am working on using box apis to create enterprise user and group. I am unable to create the user/group through curl or through java code as the request results in Forbidden error (403). Please note that the auth token has been created using enterprise admin credentials which could create the user/group in Box admin console.
Following is the curl command and its response :-
curl --insecure https://api.box.com/2.0/groups -H "Authorization: Bearer AUTH-TOKEN" -H "Content-type: application/json" -d "{"\"name"\": "\"family"\"}" -X POST -v
RESPONSE :-
> POST /2.0/groups HTTP/1.1
> User-Agent: curl/7.27.0
> Host: api.box.com
> Accept: */*
> Authorization: Bearer <AUTH-TOKEN>
> Content-Length: 18
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 403 Forbidden
< S erver: nginx
< Date: Fri, 13 Dec 2013 13:04:52 GMT
< Content-Length: 0
< Connection: keep-alive
< WWW-Authenticate: Bearer realm="Service", error="insufficient_scope", error_description="**The request requires higher privileges than provided by the access token."**
Thanks,
Alevi
To call APIs that manage users you have to meet several permissions requirements.
1) The app you build has to have "Manage an Enterprise" scope (Set this up in your application management console in the "OAuth2 parameters"
2) The user logging into your app has to have co-admin permissions
3) The co-admin has to specifically be allowed to "manage users"
Unless you meet all those criteria, you won't be able to call the API to add a user.
If you do, it should be a simple POST to ./users with a json payload with the user object. See http://developers.box.com/docs/#users-create-an-enterprise-user for an example CURL call
I think you may just have the wrong slash.
Try this:
curl https://api.box.com/2.0/groups -H "Authorization: Bearer ACCESS_TOKEN" -d "{\"name\”: \“my group\”}" -X POST
Is it possible to intercept and change login information within a lua script for mysql-proxy.
for example, if a user were to hit the proxy like this:
mysql -h localhost -P 4040 -u bob -D orders -p
i would want the connection not only redirected to a backend server, but also the username/database name changed, so that the above command was the equivalent of this:
mysql -h production.server -P 3306 -u bob_production -D bob_orders -p
I notice that it seems that I can only get auth information in the script after the auth has been passed, and even if I could get it before, i don't see a way to easily inject it.
Does anyone have an idea on how this would be possible within mysql-proxy, or with some other solution?
It is possible. In the share/docs directory of the installation bundle have a look at the tutorial script tutorial-scramble.lua which is an example that validates a hashed password from a remote client and substitutes the authentication credentials required by the server.
The function used in the tutorial example is: read_auth()
You might also want to monitor the authentication response from the server which can be done with read_auth_result().