Google shopping api Request had insufficient authentication scopes - authentication

I make a request to Google shopping by curl:
curl --request POST \
'https://shoppingcontent.googleapis.com/content/v2.1/products/batch?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"entries":[]}' \
--compressed
and the response is
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"errors": [
{
"message": "Insufficient Permission",
"domain": "global",
"reason": "insufficientPermissions"
}
],
"status": "PERMISSION_DENIED"
}
}
I'm sure my access_token is right, but I'm not sure if my API_KEY is right.
My API_KEY is gotten in https://console.cloud.google.com/apis/credentials , and the API_KEY's restrictions is none.
And my Content API for Shopping is enabled:
I wonder if I miss any critical method, that I can't request the api successfully.
By the way, how can I get my merchant_id? Is it my merchant_id?
But the method "Verify and claim your website URL in Business information", I didn't pass. Does it cause to the 403 error?

Related

How to get an oauth2 url on postman

I'm trying to get the access token on Postman. I'm in "Get acces token", "body" and I'm using the 'POST' method (not the 'GET' one). When I click on the "send" button, I read this message:
{
"timestamp": "2022-11-07T21:26:28.119+00:00",
"status": 401,
"error": "Unauthorized",
"message": "",
"path": "/oidc/accessToken"
}
I think the problem is my oauth2 url. I didn't understand how to get one. I read on the internet that the url should be like this:
https://id:secret#mywebsite.com
Is it correct? I doesn't work for me.
How could I write a correct oauth2 url?
Thank you in advance!
PS: the 'code snippet' is this one:
curl --location --request POST 'https://link/accessToken' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'APIM-Debug: true' \
--data-urlencode 'client_id=' \
--data-urlencode 'client_secret=' \
--data-urlencode 'username=myusername' \
--data-urlencode 'password=mypassword' \
--data-urlencode 'grant_type=client_credentials'

Error when testing Shopify checkout API with Stripe "Cannot complete the checkout without any transactions."

I am trying to complete a checkout with the /checkout API integrated with Stripe, following this documentation: https://shopify.dev/tutorials/complete-a-sales-channel-payment-with-checkout-api#integrate-stripe-wi...
I am getting this response on my final request:
Request:
curl --location --request POST 'https://<nameofmyshop>.myshopify.com/admin/api/2021-04/checkouts/<shopify-checkout-token>/complete.json' \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Access-Token: <shpat_shopify-access-token>' \
--data-raw '{
"payment": {
"amount": "1.00",
"unique_token": "unique token I made",
"payment_token": {
"payment_data": "<tok_stripe-vault-token>",
"type": "stripe_vault_token"
},
"request_details": {
"ip_address": "123.1.1.1",
"accept_language": "en",
"user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/54.0.2840.98 Safari\/537.36"
}
}
}'
(error) Response:
422 Unprocessable Entity
{
"errors": {
"base": [
{
"code": "missing_transactions",
"message": "Cannot complete the checkout without any transactions.",
"options": {}
}
]
}
}
Some details about my Shopify Shop, and Stripe setup:
I have Shopify Payments enabled
test mode is on
I successfully placed an order though the shop's website with CC# 4242 4242 4242 4242
I have a test Stripe Connect account for my "customer"
I can successfully get a Stripe token generated for the customer
Here is my flow:
create a checkout POST https://{{store_name}}.myshopify.com/admin/api/{{api_version}}/checkouts.json
Save checkout.token, and checkout.shopify_payments_account_id from the response
Get Stripe token for customer:
curl --location --request POST 'https://api.stripe.com/v1/tokens' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Stripe-Account: {{shopify_payments_account_id}}' \
--header 'Authorization: Bearer {{stripe-token}}' \
--data-urlencode 'customer=<cus_customers-stripe-connect-id>'
save id from response "id: <tok_stripe-vault-token>"
complete checkout with Stripe token (request above)
Should we be able to complete a checkout using Shopify /checkout API + Stripe-Connect Test Accounts?
Thank you for any help!
I was using the wrong endpoint:
final request should go to /payments.json, not /complete.json
url --location --request POST 'https://<nameofmyshop>.myshopify.com/admin/api/2021-04/checkouts/<shopify-checkout-token>/payments.json' \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Access-Token: <shpat_shopify-access-token>' \
--data-raw '{
"payment": {
"amount": "1.00",
"unique_token": "unique token I made",
"payment_token": {
"payment_data": "<tok_stripe-vault-token>",
"type": "stripe_vault_token"
},
"request_details": {
"ip_address": "123.1.1.1",
"accept_language": "en",
"user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/54.0.2840.98 Safari\/537.36"
}
}
}'

How to include my user as a member in a Group type identity in Sandbox?

In Sandbox, the logged-in user needs to be a member of a group to register data products or apps.
How can I add my user to a group?
You, as user, are an identity of type Person. A Group is also a type of identity in Platform of Trust.
A Person must be linked to a Group with MemberOf type of link.
Using Identity API, you can create a Group type identity and connect your own user identity to the group with a MemberOf type link.
To create a group, run the following cURL command:
curl -i -X POST \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9eyJzY29w...DVs5aaf" \
-H "Content-Type: application/json" \
-d \
"{
"context": "https://standards.oftrust.net/v2/Context/Identity/Group/",
"type": "Group",
"data": {
"name": "Company Oy"
}
}" "https://api-sandbox.oftrust.net/identities/v1"
On Success, you'll get the following response including the ID of the created group.
Next, you need to link your user identity to the created group identity with a MemberOf type link.
option1: This post in StackOverflow discusses how to obtain the current logged-in user's ID.
OR,
option2:
Start with getting your user ID (you need to be logged-in into the Sandbox) using /me end
point of Login API
Request:
curl -i -X GET \
-H "Authorization: Bearer eyJ0eXAi...hdEsJLNGV2YA" \
"https://api-sandbox.oftrust.net/me"
Response:
HTTP/1.0 200
{
"#context": "https://standards.oftrust.net/v2/Context/Identity/LegalParty/Person/",
"#type": "Person",
"#id": "33237067-14c3-4801-9e50-bf08406406e2",
"email": "user#example.com",
"role": "developer",
"firstName": "Anna",
"lastName": "Bar"
}
Then make a POST request to Identity API with Identity IDs of your user and the created group as parameters:
curl -i --request POST \
--url https://api-sandbox.oftrust.net/identities/v1/{fromIdentityId}/link/{toIdentityId} \
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9eyJzY29w...DVs5aaf' \
--header 'content-type: application/json' \
--data '{
"context": "https://standards.oftrust.net/v2/Context/Link/Role/MemberOf/",
"type": "MemberOf"
}'
Remember to set the parameters as the following:
fromIdentityId = ID of your own user
toIdentityID = ID of the created group above.
On success, you should receive the following response:
HTTP/1.0 201
{
"#context": "https://standards.oftrust.net/v2/Context/Link/Role/MemberOf/",
"#type": "MemberOf",
"#id": "be7a2c57-03d8-46f4-aaf0-2b1ca118ef5c",
"from": "8ac7494b-b7bc-4a63-a253-4b9b1887b262",
"to": "a6b5a74e-bd98-4c9b-9561-932877258833",
"data": {},
"metadata": {
"createdAt": "2019-09-12T09:49:24+00:00",
"createdBy": "33237067-e72c-4f26-b78b-9f9e234b2e7d",
"updatedAt": "2019-09-12T09:49:24+00:00",
"updatedBy": "33237067-e72c-4f26-b78b-9f9e234b2e7d"
}
}
Now you will bee able to use the created group to register data products and apps in Platform of Trust.
Alternatively, you can use world-sandbox.oftrust.net to create your group identity using the UI. Simply save the group ID that appears in the S-alert.
Checkout Identity API documentation here.
You can also use our Insomnia Workspace and Guide to execute chain request to create a Group.

How i can send message to individual Line User?

I want to send message to private user not in any bot or group. How i can send ?
Thanks in advance
Line have API to send to one private user.
curl -v -X POST https://api.line.me/v2/bot/message/push \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {channel access token}' \
-d '{
"to": "U4af4980629...",
"messages":[
{
"type":"text",
"text":"Hello, world1"
},
{
"type":"text",
"text":"Hello, world2"
}
]
}'
See the documentation: https://developers.line.biz/en/reference/messaging-api/#send-push-message

Linkedin V1 update-comments-as-company api throws 500 error code

We are using Linkedin v1 api update-comments-as-company endpoint to post comments on behalf of company page managed by the user. Nowadays this endpoint throws 500 error response while trying to add comment.
Example request:
curl -X POST -H "Authorization: Bearer xxxx" -H "Content-Type: application/json" -H "x-li-format: json" 'https://api.linkedin.com/v1/companies/12345/updates/key=UPDATE-c12345-640455667889990765/update-comments-as-company' --data '{"comment": "Posting as a company!"}'
Response:
{
"errorCode": 0,
"message": "Internal service error",
"requestId": "OBVNKWRJDC",
"status": 500,
"timestamp": 1528183732917
}
Kindly help me to resolve this.