Help with API sample upload
AnsweredHello. I am trying to upload a text file as a test sample. I have tried every version I can think of and keep getting the same 404 not found. Here is my code.
curl -v -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $token" "https://api.app.wdesk.com/platform/v1/testForms/$form_id/testPhases/$phase_id/matrices/$matrix_id/samples/$sample_id/attachmentsUpload" -d '{"fileName": "out2"}'
I know that my token,form_id,phase_id,matrix_id, and sample_id are correct as I can run a get with the same url /attachments and it shows me current attachments. The API documentation says it should be attachmentUpload but it errors without the s like attachmentsUpload. I know that the attachment out2 is found because changing the name returns a file not found error. I have also tried using -F file=@out2 instead of -d.
Here is the verbose output with my bearer token cut off. Can anyone tell me what I am doing wrong?
curl -v -X POST -H 'Content-Type: application/json' -H 'Accept: applicatioom/platform/v1/testForms/$form_id/testPhases/$phase_id/matrices/$matrix_id/samples/$sample_id/attachmentsUplo
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 108.156.224.124:443...
* Connected to api.app.wdesk.com (108.156.224.124) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=api.app.wdesk.com
* start date: Feb 22 00:00:00 2023 GMT
* expire date: Aug 26 23:59:59 2023 GMT
* subjectAltName: host "api.app.wdesk.com" matched cert's "api.app.wdesk.com"
* issuer: C=US; O=Amazon; CN=Amazon RSA 2048 M02
* SSL certificate verify ok.
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> POST /platform/v1/testForms/f68941b5-f1e3-4adf-a245-7fc7cb3ae77e/testPhases/baaf65d4-2ae5-412f-9ed8-159a54dd-e185-4504-b26b-e28eaed6d4be/attachmentsUpload HTTP/1.1
> Host: api.app.wdesk.com
> User-Agent: curl/7.81.0
> Content-Type: application/json
> Accept: application/json
> Authorization: Bearer eyJhJVWhUFNinS7de5gtzbqWqp9jNi77OH7IQ
> Content-Length: 20
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: application/json
< Content-Length: 0
< Connection: keep-alive
< Date: Thu, 01 Jun 2023 00:24:15 GMT
< x-amzn-RequestId: bb9d6f10-44c0-4385-839d-80f30df3b74a
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< x-amz-apigw-id: F0C_aHIgoAMFvYQ=
< X-Cache: Error from cloudfront
< Via: 1.1 01b6d83a9b2cdd6c2a5f42b34f1e78dc.cloudfront.net (CloudFront)
< X-Amz-Cf-Pop: DFW56-P4
< X-Amz-Cf-Id: cYROD00OZ79RomcTBNaJe1UfaGSYO04_ki0khGnvnZabcLbNu6wF3w==
<
* Connection #0 to host api.app.wdesk.com left intact
-
Official comment
Hi Jason, the final part of that path should definitely be "/attachmentUpload" not "/attachmentsUpload", that's why the script run you posted resulted in a 404. Do you have verbose output available when using "/attachmentUpload"? I'm happy to take a look and see if I can figure out the issue.
Thanks Mike. I guess I was getting the error because I was attaching the payload incorrectly at the time I tried it. It does complete now but my filename is not showing up. I get the response with the upload URL and then try to use it and get forbidden. I have assigned all possible scopes to my token.
xymon@clvintubu01:~/scripts/wdesk$ curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $token" "https://api.app.wdesk.com/platform/v1/testForms/$form_id/testPhases/$phase_id/matrices/$matrix_id/samples/$sample_id/attachmentUpload" -d '{"fileName": "out2.txt"}'
{"uploadUrl":"https://h.app.wdesk.com/s/blob-storage/api/v1/blobs/QWNjb3VudB8xMTg0NDkyMTgzNg/YnMyOjA6YWE3YTFkOTU2ODU4NDUyYWIwMzExMDY5Yjk3YjUzYWE?action=upload\u0026cid=4099478f-0378-4841-9f71-5adcc3a573d8\u0026client=w-annotations-service\u0026expire=1685633486\u0026membership=TWVtYmVyc2hpcB8xMTkxMDUyMTgzNA\u0026organization=1af2443c-8462-4dd6-bf3c-fae744f2ccde\u0026requester=default\u0026scope=w-annotations-service\u0026user=V0ZVc2VyHzExMjM2ODUxOTM0\u0026sig=27ac00010b98faa777d1e329f351e5ffc59658ba4c2401c4725c3d857a043c30"}
xymon@clvintubu01:~/scripts/wdesk$ curl -v -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $token" -H 'Content-Type: text' -T out2.txt "https://h.app.wdesk.com/s/blob-storage/api/v1/blobs/QWNjb3VudB8xMTg0NDkyMTgzNg/YnMyOjA6YWE3YTFkOTU2ODU4NDUyYWIwMzExMDY5Yjk3YjUzYWE?action=upload\u0026cid=4099478f-0378-4841-9f71-5adcc3a573d8\u0026client=w-annotations-service\u0026expire=1685633486\u0026membership=TWVtYmVyc2hpcB8xMTkxMDUyMTgzNA\u0026organization=1af2443c-8462-4dd6-bf3c-fae744f2ccde\u0026requester=default\u0026scope=w-annotations-service\u0026user=V0ZVc2VyHzExMjM2ODUxOTM0\u0026sig=27ac00010b98faa777d1e329f351e5ffc59658ba4c2401c4725c3d857a043c30"
* Trying 172.65.210.247:443...
* Connected to h.app.wdesk.com (172.65.210.247) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=5602150; C=US; ST=Iowa; L=Ames; O=Workiva Inc.; CN=app.wdesk.com
* start date: Jun 15 00:00:00 2022 GMT
* expire date: Jun 15 23:59:59 2023 GMT
* subjectAltName: host "h.app.wdesk.com" matched cert's "h.app.wdesk.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* Using Stream ID: 1 (easy handle 0x5642d0dee190)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> PUT /s/blob-storage/api/v1/blobs/QWNjb3VudB8xMTg0NDkyMTgzNg/YnMyOjA6YWE3YTFkOTU2ODU4NDUyYWIwMzExMDY5Yjk3YjUzYWE?action=upload\u0026cid=4099478f-0378-4841-9f71-5adcc3a573d8\u0026client=w-annotations-service\u0026expire=1685633486\u0026membership=TWVtYmVyc2hpcB8xMTkxMDUyMTgzNA\u0026organization=1af2443c-8462-4dd6-bf3c-fae744f2ccde\u0026requester=default\u0026scope=w-annotations-service\u0026user=V0ZVc2VyHzExMjM2ODUxOTM0\u0026sig=27ac00010b98faa777d1e329f351e5ffc59658ba4c2401c4725c3d857a043c30 HTTP/2
> Host: h.app.wdesk.com
> user-agent: curl/7.81.0
> content-type: application/json
> accept: application/json
> authorization: Bearer eyJhVy_wpXXgZsAIT_ykHlBHjbINZg3DIrhE6q_laEtX2emCskavsQ
> content-type: text
> content-length: 23306
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* We are completely uploaded and fine
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 403
< date: Thu, 01 Jun 2023 14:32:37 GMT
< content-type: text/plain; charset=utf-8
< content-length: 10
< x-content-type-options: nosniff
< content-security-policy-report-only: default-src 'self' data: *.wdesk.com *.google-analytics.com https://embed-ssl.wistia.com https://app.pendo.io https://support.workiva.com https://fast.wistia.net; img-src 'self' data: blob: *.wdesk.com *.google-analytics.com https://cdn.pendo.io https://app.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com https://data.pendo.io https://v2assets.zopim.io https://static.zdassets.com https://support.workiva.com; object-src 'self' blob: *.wdesk.com *.google-analytics.com https://embed-ssl.wistia.com; script-src 'self' 'unsafe-eval' *.wdesk.com *.google-analytics.com https://ajax.googleapis.com https://gov-bam.nr-data.net https://js-agent.newrelic.com https://app.pendo.io https://pendo-io-static.storage.googleapis.com https://cdn.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com https://data.pendo.io https://support.workiva.com 'sha256-zkcQTxCWSUk7lVrVAMOuLRFBy2TsYZLZhiXauWEXUqY=' https://appsforoffice.microsoft.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' *.wdesk.com https://app.pendo.io https://cdn.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com https://support.workiva.com; connect-src 'self' *.wdesk.com:* wss://*.wdesk.com:* *.google-analytics.com https://gov-bam.nr-data.net https://app.pendo.io https://data.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com wss://*.zopim.com https://*.zopim.com wss://workiva.zendesk.com wss://workiva1561339530.zendesk.com https://workiva.zendesk.com https://workiva1561339530.zendesk.com https://id.zopim.com http://api.feedback.us.pendo.io/; report-uri https://scixb6ful0.execute-api.us-east-1.amazonaws.com/prod/csp
< strict-transport-security: max-age=31536000; includeSubDomains
< x-xss-protection: 1; mode=block
< cf-cache-status: DYNAMIC
< server: cloudflare
< cf-ray: 7d082ac4de3945ef-DFW
<
Forbidden0Hi Jason, I think the problem is caused by a character encoding issue. Somehow all of the '?' characters in your uploadUrl got replaced with '\u0026'. I'm not super familiar with curl, but maybe one of the options is causing all question marks to be escaped. If you can figure out how to replace all of the '\u0026' with a '?' in your second curl command, I think it will work as expected. I hope that helps.
0Thanks Mike, I don't understand how that is happening. the /u0026 is in the response URL, not just in what I am sending back. I will try to substitute all occurrences with ? and see if that works but it shouldn't be coming to me from the API that way.
0Mike, Here is the output with me substituting ? for \uu026. Does this look like correct syntax? Still gets forbidden.
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $token" "https://api.app.wdesk.com/platform/v1/testForms/$form_id/testPhases/$phase_id/matrices/$matrix_id/samples/$sample_id/attachmentUpload" -d '{"fileName": "out2"}' | sed 's/\\u0026/?/g'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 551 100 531 100 20 191 7 0:00:02 0:00:02 --:--:-- 198
{"uploadUrl":"https://h.app.wdesk.com/s/blob-storage/api/v1/blobs/QWNjb3VudB8xMTg0NDkyMTgzNg/YnMyOjA6YzU2ZDBmYTY0MDgxNGMxNjkzYTljZThhNTlmZjUyMzY?action=upload?cid=93d5ba24-fb3a-49ea-bab1-7ad2855836fa?client=w-annotations-service?expire=1685652430?membership=TWVtYmVyc2hpcB8xMTkxMDUyMTgzNA?organization=1af2443c-8462-4dd6-bf3c-fae744f2ccde?requester=default?scope=w-annotations-service?user=V0ZVc2VyHzExMjM2ODUxOTM0?sig=667d4c04fafd4f47fca1a1c99634bd7eb054c94c4f37f25907a42bcbfd5be777"}
$ curl -v -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $token" -H 'Content-Type: text' -T out2.txt "https://h.app.wdesk.com/s/blob-storage/api/v1/blobs/QWNjb3VudB8xMTg0NDkyMTgzNg/YnMyOjA6YzU2ZDBmYTY0MDgxNGMxNjkzYTljZThhNTlmZjUyMzY?action=upload?cid=93d5ba24-fb3a-49ea-bab1-7ad2855836fa?client=w-annotations-service?expire=1685652430?membership=TWVtYmVyc2hpcB8xMTkxMDUyMTgzNA?organization=1af2443c-8462-4dd6-bf3c-fae744f2ccde?requester=default?scope=w-annotations-service?user=V0ZVc2VyHzExMjM2ODUxOTM0?sig=667d4c04fafd4f47fca1a1c99634bd7eb054c94c4f37f25907a42bcbfd5be777"
* Trying 172.65.210.247:443...
* Connected to h.app.wdesk.com (172.65.210.247) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: jurisdictionC=US; jurisdictionST=Delaware; businessCategory=Private Organization; serialNumber=5602150; C=US; ST=Iowa; L=Ames; O=Workiva Inc.; CN=app.wdesk.com
* start date: Jun 15 00:00:00 2022 GMT
* expire date: Jun 15 23:59:59 2023 GMT
* subjectAltName: host "h.app.wdesk.com" matched cert's "h.app.wdesk.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 Extended Validation Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* Using Stream ID: 1 (easy handle 0x55e4da963190)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> PUT /s/blob-storage/api/v1/blobs/QWNjb3VudB8xMTg0NDkyMTgzNg/YnMyOjA6YzU2ZDBmYTY0MDgxNGMxNjkzYTljZThhNTlmZjUyMzY?action=upload?cid=93d5ba24-fb3a-49ea-bab1-7ad2855836fa?client=w-annotations-service?expire=1685652430?membership=TWVtYmVyc2hpcB8xMTkxMDUyMTgzNA?organization=1af2443c-8462-4dd6-bf3c-fae744f2ccde?requester=default?scope=w-annotations-service?user=V0ZVc2VyHzExMjM2ODUxOTM0?sig=667d4c04fafd4f47fca1a1c99634bd7eb054c94c4f37f25907a42bcbfd5be777 HTTP/2
> Host: h.app.wdesk.com
> user-agent: curl/7.81.0
> content-type: application/json
> accept: application/json
> authorization: Bearer eyJhbGciOiJSUzUxMiIsInR5cr1cF5ONYu
> content-type: text
> content-length: 23306
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* We are completely uploaded and fine
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 403
< date: Thu, 01 Jun 2023 19:48:03 GMT
< content-type: text/plain; charset=utf-8
< content-length: 10
< x-content-type-options: nosniff
< content-security-policy-report-only: default-src 'self' data: *.wdesk.com *.google-analytics.com https://embed-ssl.wistia.com https://app.pendo.io https://support.workiva.com https://fast.wistia.net; img-src 'self' data: blob: *.wdesk.com *.google-analytics.com https://cdn.pendo.io https://app.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com https://data.pendo.io https://v2assets.zopim.io https://static.zdassets.com https://support.workiva.com; object-src 'self' blob: *.wdesk.com *.google-analytics.com https://embed-ssl.wistia.com; script-src 'self' 'unsafe-eval' *.wdesk.com *.google-analytics.com https://ajax.googleapis.com https://gov-bam.nr-data.net https://js-agent.newrelic.com https://app.pendo.io https://pendo-io-static.storage.googleapis.com https://cdn.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com https://data.pendo.io https://support.workiva.com 'sha256-zkcQTxCWSUk7lVrVAMOuLRFBy2TsYZLZhiXauWEXUqY=' https://appsforoffice.microsoft.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' *.wdesk.com https://app.pendo.io https://cdn.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com https://support.workiva.com; connect-src 'self' *.wdesk.com:* wss://*.wdesk.com:* *.google-analytics.com https://gov-bam.nr-data.net https://app.pendo.io https://data.pendo.io https://pendo-static-5073055586713600.storage.googleapis.com wss://*.zopim.com https://*.zopim.com wss://workiva.zendesk.com wss://workiva1561339530.zendesk.com https://workiva.zendesk.com https://workiva1561339530.zendesk.com https://id.zopim.com http://api.feedback.us.pendo.io/; report-uri https://scixb6ful0.execute-api.us-east-1.amazonaws.com/prod/csp
< strict-transport-security: max-age=31536000; includeSubDomains
< x-xss-protection: 1; mode=block
< cf-cache-status: DYNAMIC
< server: cloudflare
< cf-ray: 7d09f8d26b9f1446-DFW
<
Forbidden
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Connection #0 to host h.app.wdesk.com left intact0Apologies Jason, I misspoke earlier. The "\u0026" escape sequence should be replaced with Ampersand "&", not a question mark. JSON parsing tools will automatically make these substitutions for you. jq is one popular command line option that I've used. If you have the json output from the "POST /attachmentUpload" request saved in "output.json", then you can use
jq '.uploadUrl' output.json
This will extract the upload url and substitute any escape characters in the JSON.
I also confirmed that those "\u0026" escape sequences are coming from our end, not from curl. Although it is valid to include those escaped characters according to the spec, it is certainly inconvenient for anyone trying to work with the raw JSON. I'll do some investigation into why we are escaping those ampersands.
0Yes, that was the trick. It works if I use & and the do the upload. Thanks,
curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H "Authorization: Bearer $token" "https://api.app.wdesk.com/platform/v1/testForms/$form_id/testPhases/$phase_id/matrices/$matrix_id/samples/$sample_id/attachmentUpload" -d '{"fileName": "out2"}' | sed 's/\\u0026/\&/g'
0Please sign in to leave a comment.
Comments
7 comments