This is a strange curl request... I don't think whomever wrote it was
a regular curl user. For example, he's coding the authrorization
string manually instead of using curl's normal userid/password
parameters. And I don't understand why he's coding "no-cache"...
that would only make sense for a web browser, but he's using curl...
But, yeah... you can do this with HTTPAPI.
a) the content-type is a parameter, use that, do not code a custom
header.
b) likewise for authorization, use http_setAuth(), not a custom header
c) For the custom headers you do need (file_name, table_name,
table_sys_id) you'll need to use an ADDL_HEADER exit procedure.
d) for the "data" parameter, just pass it in the upload data. If
using http_stmf or http_req, you just use the path to your PDF. If
you're using the older set of APIs, use http_post_stmf() to point to
your PDF.
-SK
On 1/25/2018 7:14 AM, KEVIN SCHREUR wrote:
All I need to replicate a curl request to upload a PDF to a site from
the System I release 7.1. Could someone assist since even though I’ve
used HTTPAPI for retrieving XML documents and posting them I haven’t
used it for uploading a file, and since I don’t know curl, I’m hoping
someone can translate what it is doing and provide some help. I’d
fight through it myself, but time is of the essence in providing a
System I solution. Thanks.
curl --request POST --url
'https://test.service.com/api/now/attachment/file?table_name=u_total_statements&tablype=document%2Fpdf'
--header 'authorization: Basic SlN5bm93aWVjVGVzdDpUZXN0MTIzNA=='
--header 'cache-control: no-cache' --header 'content-type:
document/pdf'
--header 'file_name: 29_March_2017.pdf' --header 'table_name:
u_total_statements' --header 'table_sys_id:
dab3ae544f3383006e5f6cd18110c790' --data 29_March_2017.pdf \
Thanks, Kevin
---
This email has been checked for viruses by AVG.
http://www.avg.com
--
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi