Here is my auth0 code which i am using to send otp and i have twilio setup
curl --request POST \
--url 'https://dev-amftxahu.us.auth0.com/passwordless/start' \
--header 'content-type: application/json' \
--data '{"client_id": "clientid", "client_secret": "secret", "connection": "sms", "phone_number": "number","send": "code"}'
Error i am getting
{"error":"sms_provider_error","error_description":"Authentication Error - invalid username (Code: 20003)"}%
Please take a look what can be the error.
Related
I'm trying to make an API call to Fathom Analytics. But I cannot figure out the filtering option (e.g. filter reportings for specific pathname). Can someone help me figuring this out?
curl --location --request GET 'https://api.usefathom.com/v1/aggregations?entity=pageview&entity_id=[SITE_ID_HERE]&aggregates=visits, uniques, pageviews, avg_duration, bounce_rate' \
--header 'Authorization: Bearer [BEARER_TOKEN_HERE]'
How can I insert the json-payload here in order to use the Fathom Filter option (https://usefathom.com/api#aggregation)
Also, I rebuilt the api call in python, without success. When I remove the payload from the API call it works just fine.
import requests
endpoint = "https://api.usefathom.com/v1/aggregations?entity=pageview&entity_id=[SITE_ID]&aggregates=pageviews,visits,uniques,avg_duration,bounce_rate&date_from=2022-10-01&date_to=2022-10-31"
payload = [{"property": "pathname",
"operator": "is",
"value": "/[URL TO FILTER]"}]
headers = {
"Authorization": "[BEARER_TOKEN]"}
response=requests.get(endpoint, json=payload, headers=headers)
print(response.json())
I struggled a bit with this too, and in my case it worked when I included the "filter" key name in the JSON payload itself rather than the curl command.
Here's what worked for me:
curl https://api.usefathom.com/v1/aggregations \
-H "Authorization: Bearer [BEARER_TOKEN_HERE]" \
-H "Accept: application/json" \
-d entity="pageview" \
-d entity_id="[SITE_ID_HERE]" \
-d aggregates="pageviews" \
-d "{'filters': [{'property':'country', 'operator':'is', 'value':'UK'}]}" \
-G
Moving the JSON to its own file (payload.json) and updating that curl line to this also worked:
-d #payload.json \
[API google GMB] Can not upload a photo using the media.upload API for Upload from bytes.
Hi I am trying to upload a photo from bytes using the google my business API following the steps describe in the next guide: guide upload from bytes.
For test I am using curl requests.
the step are:
Get the MediaItemDataRef (This step work without problem):
curl -X POST -v -H "Authorization: Bearer <access_token>"
"https://mybusiness.googleapis.com/v4/accounts//locations//media:startUpload"
I receive a "resourceName" variable.
Use the resourceName returned by the call made in the
previous step to upload the bytes:
curl -X POST -T ~/<patch_to_the_file.png> -v -H "Authorization:
Bearer <access_token>"
"https://mybusiness.googleapis.com/upload/v1/media/<resourceName>?uploadType=media"
Call Media.Create using the resourceName returned in Step 1:
curl -X POST
--data '{"mediaFormat":"PHOTO","locationAssociation"{"category":"FOOD_AND_DRINK"},"dataRef":
{"resourceName":"<resourceName>"}}'
-H "Authorization: Bearer <access_token>
-H "Content-Type: application/json"
"https://mybusiness.googleapis.com/v4/accounts/<id_account>/locations/<id_
locations>/media"
In the 3 step I receive the following error in the answers:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
"errorDetails": [
{
"code": 1000,
"message": "Fetching image failed."
}
]
}
]
}
}
I had to try the same steps in Python and I have the same error, so I want to know what my error is in the request.
Thank you.
I had a similar phenomenon.
And I was able to solve the problem.
In my case, the posting cycle for the same store was about 18 seconds, but when I corrected it to a 60-second cycle, it was resolved.
I'm new on REST API's and I'm unable to make run an http request.
If I try the curl command it works by terminal:
curl \
--request POST \
--header "X-OpenAM-Username: user" \
--header "X-OpenAM-Password: password" \
--header "Content-Type: application/json" \
--data "{}" \
http://openam.sp.com:8095/openamSP/json/authenticate
and the result:
{"tokenId":"AQIC5wM2LY4Sfczw67Mo6Mkzq-srfED3YO8GCSe0Be6wtPs.*AAJTSQACMDEAAlNLABM2NzQ5NjQ4Mjc0MDY0MzEwMDEyAAJTMQAA*","successUrl":"/openamSP/console"}
But now, from my web on Django I want to make a request and I'm unable to make it work, the code that I use it's:
import requests
headers = {'X-OpenAM-Username':'user', 'X-OpenAM-Password':'password', 'Content-Type':'application/json'}
data = {}
r = requests.get('http://openam.sp.com:8095/openamSP/json/authenticate', headers=headers, params=data)
and if I check the answer:
u'{"code":405,"reason":"Method Not Allowed","message":"Method Not Allowed"}'
What I'm doing wrong? I can't see where is my mistake.
Thanks and regards.
You are doing everything correct, except POST method just do this:
r = requests.post('http://openam.sp.com:8095/openamSP/json/authenticate', headers=headers, params=data)
The method URL receives is POST method not GET.
I need to convert the following cURL command to python requests.
curl 'https://test.com/api/v1/courses/xx/discussion_topics/xx/entries.json' \
-F 'message=<message>' \
-H "Authorization: Bearer <token>"
So far I have requests.post("https://test.com/api/v1/courses/xx/discussion_topics/xx/entries")
but how do I add the message and auth?
requests.post("https://test.com/api/v1/courses/xx/discussion_topics/xx/entries.json, data=json.dumps({"message": "<message>"}), headers={"Authorization": "Bearer <token>"})
If I have the following curl request:
curl --dump-header - -H "Content-Type: application/json" -u TEST:TEST -X POST --data '{"alert": "[\"CPU\", \"Server\", \"Heartbeat\", \"Ping\"]", "id": 11, "pattern": ".*\\.websys\\.tmcs", "product": "TMOL", "pub_date": "2014-08-05 12:15:17", "resource_uri": "/tool/api/v1/sys_team/11/", "sys_team": "WebSys#xxxxxx.com","group":"WebSys"}' http://localhost:8000/tool/api/v1/sys_team/
Is there anyway I can get access to the -u information (specifically the username)? I can't use request.user.username because I want to authenticate the user based on the group he/she is in so it defaults to Anonymous user because it isn't authenticated yet.
The command you wrote will send the TEST username and TEST password using the HTTP header Authorization.
Authorization: USERNAME THE_PASSWORD_USING_BASE64_ENCODING
You can read more about the Basic access authentication here: http://en.wikipedia.org/wiki/Basic_access_authentication