How to send result in survey monkey using CURL - api

I create a new survey form using survey monkey, and i get all questions using api and create custom form in my site. Now how can we update the result in survey monkey using CURL. I tired this /surveys/{id}/pages/{id}/questions/{id} but no response.
Version : V3

By "update the result" I presume you mean you want to create a new response for your survey.
You can do that with the response API. There is cURL examples on the right side of the page. Something along the lines of:
curl -i -X POST https://api.surveymonkey.net/v3/collectors/{collector_id}/responses \
-H "Content-Type: application/json" -H "Authorization:bearer <your_access_token>" \
-d '{
"pages": [{
"id": "<page_id>",
"questions": [{
"answers": [{
"choice_id": "<choice_id>"
}],
"id": "<question_id>"
}, {
"answers": [{
"text": "<open ended response>"
}],
"id": "<question_id>"
}]
}]
}'
Depending on the question types you have in your survey. Make sure you have a collector created already.
Given you are just trying to embed a survey on your website, I recommend you just use a website collector instead of trying to automate this yourself (depending on your use case).

Related

How to setup Adyen acquirer account

I have a problem with testing MB WAY for API only payment method on Adyen https://docs.adyen.com/payment-methods/mb-way/api-only
After I send request as described here https://docs.adyen.com/payment-methods/mb-way/api-only#make-payment
curl https://checkout-test.adyen.com/v68/payments \
-H 'x-api-key: YOUR_API_KEY' \
-H 'content-type: application/json' \
-d '{
"merchantAccount": "YourCompanyECOM",
"reference": "My first Adyen test payment",
"amount": {
"value": 1000,
"currency": "EUR"
},
"paymentMethod": {
"type": "scheme",
"encryptedCardNumber": "test_4111111111111111",
"encryptedExpiryMonth": "test_03",
"encryptedExpiryYear": "test_2030",
"encryptedSecurityCode": "test_737"
}
}'
I receive this response
{
"status": 500,
"errorCode": "905_1",
"message": "Could not find an acquirer account for the provided txvariant (mbway), currency (EUR), and action (AUTH).",
"errorType": "configuration",
"pspReference": "GBSGRNJVSBLZNN82"
}
I did not found a way to set up an acquirer account on Adyen dashboard so far. Is that option there, or I need to do something else to make it work?
This kind of error can have as origin one of the following reasons:
The currency is not configured or supported
The minimum amount is set too low
The payment method is not configured on your account
The payment type (shopperInteraction) is not supported.
The full documentation of this error is here

Printful Oauth Api Prod. Upload

Description:
Oki, i am trying to upload products to printful via api
|> __ they changed to oauth and the docs are not matching anymore
|> __ the functionality itself is in their docs, but i cant get it to auth
|> __ their dev support was not helpful and i am not a api person
Assets:
=>> https://developers.printful.com/docs/#section/Products-API-examples/Create-a-new-Sync-Product
=>> https://developers.printful.com/docs/#operation/createSyncProduct
Code:
heres my error and code basically directly from their docs:
{"code":200,"result":"Welcome to the Printful API","extra":[]}
{"code":400,"result":"This API endpoint applies only to Printful stores based on the
Manual Order / API platform.
Find out more at Printful API docs.","error":{"reason":"BadRequest","message":
"This API endpoint applies only to Printful stores based on the Manual Order
/ API platform. Find out more at Printful API docs."}}%
# Authorized CURL request with Basic auth
curl -X GET 'https://api.printful.com/' \
-H 'Authorization: Bearer TOKEN'
curl --location --request POST 'https://api.printful.com/store/products' \
-H 'Authorization: Bearer SAMEtOKEN' \
--data-raw '{
"sync_product": {
"name": "T-Shirt",
"thumbnail": "https://picsum.photos/200/300"
},
"sync_variants": [
{
"retail_price": 21.00,
"variant_id": 4011,
"files": [
{
"url": "https://picsum.photos/200/300?image=1"
},
{
"type": "back",
"url": "https://picsum.photos/200/300?image=1"
}
]
},
{
"retail_price": 21.00,
"variant_id": 4012,
"files": [
{
"url": "https://picsum.photos/200/300?image=1"
},
{
"type": "back",
"url": "https://picsum.photos/200/300?image=1"
}
]
}
]
}'
To save anyone else the headache:
The Printful 'Create Product' and similiar API calls don't work with shops created via the automatic API integrations:
As far as I'm aware there is no workaround, but if I find one I'll update here. The name is a bit misleading, as the 'Sync Products' seem to describe products capable of syncing with external services. However you are limited to the ECommerce Platform Sync API calls. It seems to be possible to modify an existing one, but that doesn't help much for GUI-free automation.
Maybe you can you create a number of placeholders as 'Drafts' and modify, but haven't gotten that running myself yet.

Cannot create new Pipeline using Az DevOps Pipelines API 6.0-preview.1

I'm trying to create new Pipelines using this API endpoint:
POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1
This is the request I'm using:
curl -X POST \
'https://dev.azure.com/<myorg>/<myproj>/_apis/pipelines?api-version=6.0-preview.1' \
-H 'Authorization: Basic <b64string>' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"configuration":{
"repository": {
"id": "<repo-guid>",
"name": "<repo-name>",
"type": "azureReposGit"
},
"path": "pipeline.yaml",
"type": "yaml"
},
"folder": "\\custompath\\",
"name": "<pipelinename>"
}
I keep getting the same error:
{
"$id": "1",
"innerException": null,
"message": "Value cannot be null.\r\nParameter name: repositoryName",
"typeName": "System.ArgumentNullException, mscorlib",
"typeKey": "ArgumentNullException",
"errorCode": 0,
"eventId": 0
}
It seems an issue with my payload, but documentation isn't very helpful about it
https://learn.microsoft.com/en-us/rest/api/azure/devops/pipelines/pipelines/create?view=azure-devops-rest-6.0
Current version o nodejs sdk doesn't support the Pipeline API yet. Can anyone help me?
I'm able to reproduce your issue on my side, and have reported this issue at website below:
https://developercommunity.visualstudio.com/content/problem/1101376/create-pipeline-rest-api-does-not-work.html
Product team has provided response that "A fix for this issue has been prepared. It should be released to everyone within the next 3 weeks."

What is the supossed scope for translating file format to SFV?

Im going along with the tutorial from:
https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prepare-file-for-viewer/
and i got stuck with translating the file to SVF. I've tried data:write, data:create, bucket:update scopes but each time I get:
Token does not have the privilege for this request.
{
"input": {
"urn": "someUrn="
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}
You will need both data:read and (data:write or data:create) (delimited by space) - see doc here:
curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate'
-X 'POST'
-H 'Content-Type: application/x-www-form-urlencoded'
-d '
client_id=obQDn8P0GanGFQha4ngKKVWcxwyvFAGE&
client_secret=eUruM8HRyc7BAQ1e&
grant_type=client_credentials&
scope=data:read%20data:write
'
And did you select Model Derivative API when creating the Forge app - if not, start over and create the app again:
Thanks,
I've run also with some different translation errors, but it turns out .rfa files are not supported in the Model Derivative API.
But all in all it worked out

Check whether a test case already exists before creating it - TFS 2018

I am creating a test case in TFS 2018 using postman like this:
curl -X POST \
'https://TFSURL:443/DefaultCollection/PROJECT/_apis/wit/workitems/$Test%20Case?api-version=4.1' \
-H 'Authorization: Basic MYKEY' \
-H 'Content-Type: application/json-patch+json' \
-d '[
{
"op": "add",
"path": "/fields/System.AreaPath",
"from": null,
"value": "TEST\\Automation"
},
{
"op": "add",
"path": "/fields/System.IterationPath",
"from": null,
"value": "TEST\\Sprint 8"
},
{
"op": "add",
"path": "/fields/System.Title",
"from": null,
"value": "Sample task"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.Steps",
"value": "<steps id=\"0\">
<step id=\"1\" type=\"ValidateStep\"><parameterizedString isformatted=\"true\">Input step 1</parameterizedString><parameterizedString isformatted=\"true\">Expectation step 1</parameterizedString><description/></step>
<step id=\"2\" type=\"ValidateStep\"><parameterizedString isformatted=\"true\">Input step 2</parameterizedString><parameterizedString isformatted=\"true\">Expectation step 2</parameterizedString><description/></step>
<step id=\"3\" type=\"ValidateStep\"><parameterizedString isformatted=\"true\">Input step 3</parameterizedString><parameterizedString isformatted=\"true\">Expectation step 3</parameterizedString><description/></step>
<step id=\"4\" type=\"ValidateStep\"><parameterizedString isformatted=\"true\">Input step 4</parameterizedString><parameterizedString isformatted=\"true\">Expectation step 4</parameterizedString><description/></step></steps>"
}
]'
How can I check before sending this request that this test exist so that I can update it instead of creating a new one every time?
I was expecting to do it by :
searching the name of the automation which should be unique in tfs (method name from automation script) and see if it returns something
It seems like in tfs there is a way to do a request to get all work items but I am not sure if you can return based on the title field of the item. (Help page on how to do this request)
I tried to use the search api to return the results if anything with that name exists in tfs but I am getting an error message which I don't know how to resolve
curl -X POST \
'https://TFSURL:443/DefaultCollection/PROJECT/_apis/search/workitemsearchresults?api-version=4.1-preview' \
-H 'Authorization: Basic MYKEY' \
-H 'Content-Type: application/json' \
-d '[
{
"searchText": "Sample task",
"$skip": 0,
"$top": 1,
"filters": {
"System.AreaPath": [
"TEST\\Automation"
]
},
"$orderBy": [
{
"field": "system.id",
"sortOrder": "ASC"
}
],
"includeFacets": true
}
]'
'
Response:
{
"count": 1,
"value": {
"Message": "An error has occurred."
}
}
Just to answer my own question in case someone else needs it, as I have read you can't do this with just a single or two different API calls. for the following solution i have created multiple REST API request to TFS and called/processed them with Python >3.
What I have done in order to update a test case if it exist or create a new one it if it is not:
Create in tfs a query which returns all test cases
Update query using an API request and the key of the query you have created (i specified iteration and team specifically in the body of the request) (help)
Create an API request to get the result of that query (help)
In a loop i was iterating over all the test case ids the query has returned
In the same loop I have used the test case id to access with a request that specific work item (help)
I then compared the title of the returned item versus the title that i want to create from my automate script (ClassName_MethodName)
If those titles where the same I do a request to update that test case using the test id i got and then break from the loop
If the titles were different i create a new test case and then break from the loop
I know this is not the fastest solution but at least it is working!
If there is another way which is easier and faster I am more than happy to follow it.