v. 3.7.1 REST API Questions

8 views
Skip to first unread message

Henry Versemann

unread,
Dec 19, 2017, 11:29:59 PM12/19/17
to dot...@googlegroups.com

I have a PowerShell script which is reading an input file and sending data from the file records read in using add and update requests (https) sent to the REST API.

 

1.)    First, if I successfully add  a record through the API, then do I need to delay the process any at all, after checking for “status code = 200”, before allowing any other updates to data or relationships for that very same record? I ask because previously when I tried to do an immediate update, it seemed like data updates would happen ok, but relationship updates did not. So I added a sleep command and nothing different happens. If I do a relationship update to the same record later in a new round of file-based updates, then the relationship assignment works just fine, so it almost seems like there might be some kind of internal time limit, but I don’t know if that’s true or not. Is there?

 

 

2.)    Second, as part of the data read in each file record I have an incoming department name, to which the record is supposed to be related. Most of the time when I send an inquiry to the API to retrieve the contentlet for the department name specified I only have one contentlet returned.

a.)     However I have run into an issue now where I seem to have only one contentlet returned(though with a string of “…” at the end indicating there might be more available), but it’s name value is not the same as the one, for which I’m searching. I wasn’t sure what was happening until I went into the backend of our test site and ran the same query, for the department name of “Science”, and it brought back 11 different entries, which contained the word “Science”. So my question is, how do I iterate through all of the contentlets contained in the content object(or header) of my department search request, if indeed there are multiple contentlets returned, to get to the one I want?

 

b.)    It almost seems like the content contained in the response data that I’m receiving is truncated after the first contentlet entry, but not sure if that’s so or even why, if that is the case.

 

c.)     I tried to see if maybe there was a “NEXT” header returned with other headers in my response, but couldn’t find any.

 

This is getting way more complex than I ever expected it to be.

 

Would appreciate any help with this.

 

Thanks.

 

Henry

 

 

 

 

 

Jason Tesser

unread,
Dec 20, 2017, 8:17:05 AM12/20/17
to dot...@googlegroups.com
are you looking at the actual body of the response meaning NOT in powershell but just hit the REST API in CURL or something and look.  Cause I think dotCMS is returning what you want and what you are asking is a powershell thing not a dotCMS thing. In which case I would goto some powershell people to help 

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB3777D1C9280CFBC89777B27DAD0C0%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Henry Versemann

unread,
Dec 20, 2017, 10:59:03 AM12/20/17
to dot...@googlegroups.com

Jason,

 

I was able to figure out the item 2 problem mentioned below, and now have that working fine.

You were right about the content all being there.

 

But for item 1 below is there any delay at all required between the time that a record is added through an ADD request to the REST API, before any subsequent UPDATE request to the same record can be made?

 

If my process logic determines that the incoming file record doesn’t already have a counterpart in dotCMS then it sends the data as an ADD request to the REST API.

 

When the ADD request response returns then an immediate check of the status code returned is done and if the ADD request was successful then a subsequent UPDATE request is sent for the same record, to set a department relationship, for the same record and using the identifier for the record returned from the successful ADD request response.

 

Since this UPDATE is not apparently working, then is this the right way to make this UPDATE request?

 

Please advise, if any delay is needed between any linked ADD / UPDATE request sequences?

 

I don’t understand why the UPDATE request is not setting the relationship, especially since I’m getting a status code of 200 back from this request as well.

 

Thanks for the help.

 

Henry

Jason Tesser

unread,
Dec 20, 2017, 12:15:08 PM12/20/17
to dot...@googlegroups.com
Right we don't have the End Points Powershell is looking for.  Your issue here is the flexibility of powershell.  I am sure powershell can do it.  

Here is how you save THEN update content via REST in dotCMS. 

This works and will work using the proper End Points. 

You would have to interact with Powershell people to see how to do it in Powershell.  I do not code much in Powershell but I am sure it can solve this 


For more options, visit https://groups.google.com/d/optout.
--



3059 Grand Avenue
Suite 410-B
Miami FL 33133
Main: 
305-900-2001 | Direct: 978.294.9429

Henry Versemann

unread,
Dec 20, 2017, 12:17:22 PM12/20/17
to dot...@googlegroups.com

OK. I’ll take a look.

Thanks.

Image removed by sender.

 

 

3059 Grand Avenue

Suite 410-B

Miami FL 33133

Main: 305-900-2001 | Direct: 978.294.9429

--

http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages