create user/group not working using curl - box-api

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

Related

step-by-step replication data from local MySQL master to Google Cloud SQL slave

I need to replicate data from local database master (using MySQL 5.6) to Google Cloud SQL slave. I read the google instructions and I did it until now:
Installed MySQL 5.6 on local machine and created local instance, database and tables;
Set up to use binary files (it´s necessary for replication);
Created user "replica" to have access to master;
Created backup.sql file using mysqldump and I followed google instructions;
Upload this file to Google storage bucket;
Created 1º generation instance in google Cloud SQL;
Created database into 1º generation instance;
Restored backup.sql into database;
Next steps in google instruction is type the code into Google Shell "ACCESS_TOKEN="...
ACCESS_TOKEN="$(gcloud auth application-default print-access-token)"
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data '{"name": "[INTERNAL_MASTER_INSTANCE_NAME]",
"region": "[REGION_NAME]",
"databaseVersion": "[EXTERNAL_MASTER_DATABASE_VERSION]",
"onPremisesConfiguration": {"hostPort": "[IP_ADDRESS:PORT]"}}' \
-X POST \
https://www.googleapis.com/sql/v1beta4/projects/[PROJECT-ID]/instances
But I have a error message "400 - Invalid value for: 5.6.39 is not a valid value". Where can I find "databaseVersion": "[EXTERNAL_MASTER_DATABASE_VERSION]" in MySQL? Someone has step-by-step to configure local database using MySQL to replicate data to Google Cloud SQL?
Based on the Configuring External Masters documenation, you have 2 options for the databaseVersion:
For databaseVersion, provide the MySQL version of the master instance:
MYSQL_5_5 or MYSQL_5_6
Since you are inserting 5.6.39 instead, it's triggering the 400 error.

anybody has an idea about converting curl request to json

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.

CURL Rest API with Base64 encoded Key

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'

Get user information in PayPal sandbox environment

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.

How do I Update Fi Star Health Questionnaire with New/Updated Questions?

I am trying to update the Fi-Star Health Questionnaire and am getting into some issue which I am not sure how to solve, tried already many different things.
Basically, everything looks very clear and straight forward, I updated the schema file we are using: dataLoadQuestionnaire_QSE_beta.csv in the HQSE_curl_tester directory
and then tried to run the load command (see below):
~/HQ/HQSE_code/HQSE_curl_Tester$ sudo curl -X POST -H "Content-Type :
multipart/form-data" --form stream="#dataLoadQuestionnaire_QSE_beta.csv"
127.0.0.1:8080/questionnaire.mng.rest/rest/ktek/questionnaire/load -v
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> POST /questionnaire.mng.rest/rest/ktek/questionnaire/load HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-Type : multipart/form-data
> Content-Length: 20910
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------
b73558337a
324ed0
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Date: Mon, 29 Feb 2016 08:17:57 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
<
* Connection #0 to host 127.0.0.1 left intact
{"Boolean":false}
I tried with using http 1.0, and tried to send different headers, but i seem to continue to get this connection to host left intact and boolean false, and so my live questionnaire doesn't get updated.
Need help with this.
Anyone knows how to work with Fi-Star Health Questionnaire SE and can help?
This feature is not supported.
Changing a live (active) questionnaire is not supported.
You have to create a new questionnaire.