How do I add users to value-based custom audience via API - facebook

The following is my request:
curl -X POST https://graph.facebook.com/v2.11/{customer_audience_id}}/users -d '{"payload": {"data": [["test#mail.com"]], "schema": ["EMAIL"]}}' -H "Content-Type: application/json" -H "Authorization: Bearer {ACCESS_TOKEN}
And the Response is:
{"error":{"message":"(#100) Weighted Custom Audience requires weight attribute.","type":"OAuthException","code":100,"fbtrace_id":"123123123"}}
If add one field 'WEIGHT' into the request:
curl -X POST https://graph.facebook.com/v2.11/{customer_audience_id}}/users -d '{"payload": {"data": [["test#mail.com", 100]], "schema": ["EMAIL", "WEIGHT"]}}' -H "Content-Type: application/json" -H "Authorization: Bearer {ACCESS_TOKEN}
The response becomes:
{"error":{"message":"(#100) Raw PII type is invalid, it should be one of EXTERN_ID,EMAIL,PHONE,GEN,DOBY,DOBM,DOBD,LN,FN,FI,CT,ST,ZIP,MADID,COUNTRY,PARTIALPHONE,PHONEID,STREETNAME,STREETNUM,STREETTYPE,STREET2ROW,STREETADDRESS,APPUID,PAGEUID,F5FIRST,F5LAST,EMAIL_MD5,PHONE_MD5","type":"OAuthException","code":100,"fbtrace_id":"123123123"}}
Seems like the weight variable is not even in the list of supported parameters. My question is: Is it possible to add users into value-based custom audience through API? I cannot find any references on the documentation page.

Related

JSON_PARSER_ERROR on PATCH when updating a custom object

I am attempting to update a custom object using the Salesforce REST API as described here, but I consistently receive this 400 response
[
{
"message": "The HTTP entity body is required, but this request has no entity body.",
"errorCode": "JSON_PARSER_ERROR"
}
]
I have tried appending ?_HttpMethod=PATCH to the url and switching to a POSTcall, but while that yields 200 OK, it doesn't actually update the object. The object is "updateable" and I do have permission to edit it. Editing it directly in Salesforce works without issues.
Here is my (cleaned) request, as exported from Insomnia [Version 5.14.9 (5.14.9.1895)].
curl --request PATCH \
--url https://myInstance.salesforce.com/services/data/v20.0/sobjects/CUSTOMOBJECT/CUSTOMOBJECTID \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
"Additional_Information__c": "Test additional information"
}'
Any ideas on how I can resolve this?
According to the Salesforce documentation for sending HTTP requests with cURL, either a JSON data file needs to be sent or a ".json" extension needs to be appended to the URI.
curl --request PATCH \
--url https://myInstance.salesforce.com/services/data/v20.0/sobjects/CUSTOMOBJECT/CUSTOMOBJECTID.json \
--header 'authorization: Bearer token' \
--header 'content-type: application/json' \
--data '{
"Additional_Information__c": "Test additional information"
}'

kraken cURL REST API cannot send order saying invalid arguments

I am able to call private user API through code like this:
curl -X POST -H "Accept: application/json" -H "API-Key: mykey" -H "API-Sign: mysign" -d "nonce=123" https://api.kraken.com/0/private/Balance
feedback is telling me how much USD and ETH i have left in my account.
but when I switch to this trying to send order:
curl -X POST -H "Accept: application/json" -H "API-Key: mykey" -H "API-Sign: mysign" -d "nonce=123" 'https://api.kraken.com/0/private/AddOrder?pair=XXBTZUSD&type=buy&ordertype=market&volume=0.01'
it says {"error":["EGeneral:Invalid arguments"]}, how can i fix it?
It seems you need to set the Content-Type header to whatever it is. In this case application/x-www-form-urlencoded. Bit odd that it's not in the docs.

Can't post in a specific Yammer's group

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'

curl POST request is not working

I am trying to consume POST URL using curl. Curl request is as below:
curl -k -H "Content-Type : application/x-www-form-urlencoded;charset=UTF-8" -H "Accept: application/json, text/plain, */*" -H "Authorization : OAuth oauth_consumer_key=2IaG9fzswU1f8bJ2bWCIIQ" -X POST -d "{'consumer_id':'google_bps','app_id':'google_bps_app','user_id':'bala.gto3','first_name':'bala','last_name':'gto3','email':'bala.gto3#gmail.com'}" https://ec2-54-189-116-121.us-west-2.compute.amazonaws.com/cec_baseline/api/users/save
Although JSON data is accurate I am getting bad request error.
Response is as below:
{"status":400,"code":0,"message":"Bad Parameters: Consumer Id and Application Id Mandatory!","description":"BAD REQUEST","result":[]}
Your have set Content-Type as application/x-www-form-urlencoded so you have to send form URL encoded data :
curl -k -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \
-H "Accept: application/json, text/plain, */*" \
-H "Authorization: OAuth oauth_consumer_key=2IaG9fzswU1f8bJ2bWCIIQ" \
-X POST \
-d 'consumer_id=google_bps&app_id=google_bps_app&user_id=bala.gto3&first_name=bala&last_name=gto3&email=bala.gto3#gmail.com' \
https://ec2-54-189-116-121.us-west-2.compute.amazonaws.com/cec_baseline/api/users/save
which gives :
{"status":200,"code":1,"message":"Successfully Saved!","description":"","result":[]}
Moreover, it seems your endpoint doesn't support JSON, when issuing your previous request with Content-Type: application/json it gives :
{"status":400,"code":0,"message":"Content Type must be application\/x-www-form-urlencoded!","description":"BAD REQUEST","result":[]}

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