[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] replicating a curl request



Whats the variable look like that you are using for the path name. HINT - spaces are important. 

> 


Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550
 
-----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-
> bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of KEVIN SCHREUR
> Sent: Thursday, January 25, 2018 2:51 PM
> To: FTPAPI/HTTPAPI mailing list
> Subject: Re: [Ftpapi] replicating a curl request
> 
> I've been working on this off and on. I found the ADDL_HEADER and created
> the custom headers, I'll remove those for authorization. My biggest issue
> now is that using http_post_stmf(), it can't find my PDF.
> I've tried changing CCSID, renaming the file to all uppercase, moving it to my
> personal IFS directory. It is returning 3025 on the stat command.
> I've just upgraded to the latest version and will try again using http_stmf
> instead of the older http_post_stmf
> 
> 
> On Thu, Jan 25, 2018 at 03:32 PM, Scott Klement wrote:
> 
> > 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_sta
> tements&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
> >
> --
> _______________________________________________
> Ftpapi mailing list
> Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> http://scottklement.com/mailman/listinfo/ftpapi
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi