Empty REST API Request Results - From https powershell request

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Empty REST API Request Results - From https powershell request

Henry Versemann

I have a department in our departments structure which when I search for it using its name through the REST API brings back no contentlets, even though I can log into our backend and see the department listed in the departments structure, with some data.

 

For this reason I’m assuming that there is indeed a contentlet for the department named below and I’m just not formatting my https request properly somehow.

 

The name of the department contains a single-quote and looks like this:

 

President’s Office

 

I’ve tried replacing the single-quote with a %27 to try to properly url encode it and that doesn’t seem to work because I’m still not finding any contentlets for it, in my response, though I am still receiving back a 200 status code.

 

I have also tried converting the single-quote to two single-quotes (‘’) back to back, as well as to a back slash single quote (\’) to try to escape the single-quote, but so far nothing seems to work and bring back any data.

 

I’m actually sending my formatted url request using the Invoke-WebRequest commandlet.

 

Any help would be greatly appreciated.

 

HDV

 

 

 

 

 

 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB37772028D29B3AABEC88F77FAD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Empty REST API Request Results - From https powershell request

Nathan Keiter

Since it’s a two word term, have you tried encapsulating it in quotes or asterisks?

 

+Department.name=“President’s Office”

 

+Department.name=“*President’s Office*

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 3:22 PM
To: '[hidden email]'
Subject: [dotcms] Empty REST API Request Results - From https powershell request

 

I have a department in our departments structure which when I search for it using its name through the REST API brings back no contentlets, even though I can log into our backend and see the department listed in the departments structure, with some data.

 

For this reason I’m assuming that there is indeed a contentlet for the department named below and I’m just not formatting my https request properly somehow.

 

The name of the department contains a single-quote and looks like this:

 

President’s Office

 

I’ve tried replacing the single-quote with a %27 to try to properly url encode it and that doesn’t seem to work because I’m still not finding any contentlets for it, in my response, though I am still receiving back a 200 status code.

 

I have also tried converting the single-quote to two single-quotes (‘’) back to back, as well as to a back slash single quote (\’) to try to escape the single-quote, but so far nothing seems to work and bring back any data.

 

I’m actually sending my formatted url request using the Invoke-WebRequest commandlet.

 

Any help would be greatly appreciated.

 

HDV

 

 

 

 

 

 

 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB37772028D29B3AABEC88F77FAD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/058d9bd5ca454fe0a72b2521d061d62d%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Empty REST API Request Results - From https powershell request

Henry Versemann

Nathan,

 

No I have not but I will try that shortly.

Thanks for the response.

 

Henry

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Nathan Keiter
Sent: Monday, November 06, 2017 2:41 PM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Since it’s a two word term, have you tried encapsulating it in quotes or asterisks?

 

+Department.name=“President’s Office”

 

+Department.name=“*President’s Office*

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 3:22 PM
To: '[hidden email]'
Subject: [dotcms] Empty REST API Request Results - From https powershell request

 

I have a department in our departments structure which when I search for it using its name through the REST API brings back no contentlets, even though I can log into our backend and see the department listed in the departments structure, with some data.

 

For this reason I’m assuming that there is indeed a contentlet for the department named below and I’m just not formatting my https request properly somehow.

 

The name of the department contains a single-quote and looks like this:

 

President’s Office

 

I’ve tried replacing the single-quote with a %27 to try to properly url encode it and that doesn’t seem to work because I’m still not finding any contentlets for it, in my response, though I am still receiving back a 200 status code.

 

I have also tried converting the single-quote to two single-quotes (‘’) back to back, as well as to a back slash single quote (\’) to try to escape the single-quote, but so far nothing seems to work and bring back any data.

 

I’m actually sending my formatted url request using the Invoke-WebRequest commandlet.

 

Any help would be greatly appreciated.

 

HDV

 

 

 

 

 

 

 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB37772028D29B3AABEC88F77FAD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/058d9bd5ca454fe0a72b2521d061d62d%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB377732DC9AFDBCF9BC2DF349AD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Empty REST API Request Results - From https powershell request

Henry Versemann
In reply to this post by Nathan Keiter

Nathan,

 

Will I tried both of those alternatives with no success.

 

So then just to see if I could do it I copied the following 3 url variations into a brand new browser window and hit enter and each one brought back the data that I’m trying to get at. Here are the 3 url variations I used:

 

<a href="https://dotcmsstaging.stchas.edu:443/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:*President's%20Office*%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu:443/api/content/query/+contentType:Departments%20+Departments.Name:*President's%20Office*%20+languageId:1%20+deleted:false%20+live:true

 

 

<a href="https://dotcmsstaging.stchas.edu/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:President's%20Office*%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu/api/content/query/+contentType:Departments%20+Departments.Name:President's%20Office*%20+languageId:1%20+deleted:false%20+live:true

 

 

<a href="https://dotcmsstaging.stchas.edu/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:President's%20Office%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu/api/content/query/+contentType:Departments%20+Departments.Name:President's%20Office%20+languageId:1%20+deleted:false%20+live:true

 

So I’m not sure what the difference is when I build my url in the powershell script, but it’s not working properly.

 

So when I build my final url before submitting it through the Invoke-WebRequest commandlet I’m doing this to concatenate the different url parts together into the final url which will be subnmitted like this:

 

        $dprtmntSrchUrlPt1 = "https://dotcmsstaging.stchas.edu:443/api/content/query/+contentType:Departments%20+Departments.Name:"

        $dprtmntSrchUrlPt3 = "*%20+languageId:1%20+deleted:false%20+live:true"

 

With the dprtmntSrchUrlPt2 variable being my department name string to search with and then concatenating the individual parts together to build the final url looking like this:

 

$dptNameSrchUrl = "{0}{1}{2}" -f $dprtmntSrchUrlPt1, $dprtmntSrchUrlPt2, $dprtmntSrchUrlPt3

 

The –f then formats and concatenates all of the above string variables together to build the final url to be sent to the REST API.

 

The funny thing is when I try to submit the https request through the powershell invoke-webrequest commandlet, as shown above then I keep getting a 401 unauthorized response/status code.

 

Which probably means I don’t have my request exactly right and so the API thinks I’m trying to go to an endpoint that is either protected or doesn’t exist.

 

So I’m not sure what more to check the url for since it looks ok to me, unless the current concatenation process somehow is adding or changing some of the original characters, and thereby pointing the request to an invalid page or endpoint.

 

Any thoughts on what to try next?

 

Henry

 

 

 

 

 

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Nathan Keiter
Sent: Monday, November 06, 2017 2:41 PM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Since it’s a two word term, have you tried encapsulating it in quotes or asterisks?

 

+Department.name=“President’s Office”

 

+Department.name=“*President’s Office*

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 3:22 PM
To: '[hidden email]'
Subject: [dotcms] Empty REST API Request Results - From https powershell request

 

I have a department in our departments structure which when I search for it using its name through the REST API brings back no contentlets, even though I can log into our backend and see the department listed in the departments structure, with some data.

 

For this reason I’m assuming that there is indeed a contentlet for the department named below and I’m just not formatting my https request properly somehow.

 

The name of the department contains a single-quote and looks like this:

 

President’s Office

 

I’ve tried replacing the single-quote with a %27 to try to properly url encode it and that doesn’t seem to work because I’m still not finding any contentlets for it, in my response, though I am still receiving back a 200 status code.

 

I have also tried converting the single-quote to two single-quotes (‘’) back to back, as well as to a back slash single quote (\’) to try to escape the single-quote, but so far nothing seems to work and bring back any data.

 

I’m actually sending my formatted url request using the Invoke-WebRequest commandlet.

 

Any help would be greatly appreciated.

 

HDV

 

 

 

 

 

 

 

--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/CY4PR0501MB37772028D29B3AABEC88F77FAD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit
https://groups.google.com/d/optout.

--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/058d9bd5ca454fe0a72b2521d061d62d%40exch13c.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB377716D5B72F58F8DC682F70AD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Empty REST API Request Results - From https powershell request

Nathan Keiter

Well, unfortunately I have zero experience using PowerShell program scripts.

 

Could you check the access logs on the dotCMS server and see what URL is actually hitting the server? That might give you a clue as to what is malformed by the script.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 5:05 PM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Nathan,

 

Will I tried both of those alternatives with no success.

 

So then just to see if I could do it I copied the following 3 url variations into a brand new browser window and hit enter and each one brought back the data that I’m trying to get at. Here are the 3 url variations I used:

 

<a href="https://dotcmsstaging.stchas.edu:443/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:*President's%20Office*%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu:443/api/content/query/+contentType:Departments%20+Departments.Name:*President's%20Office*%20+languageId:1%20+deleted:false%20+live:true

 

 

<a href="https://dotcmsstaging.stchas.edu/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:President's%20Office*%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu/api/content/query/+contentType:Departments%20+Departments.Name:President's%20Office*%20+languageId:1%20+deleted:false%20+live:true

 

 

<a href="https://dotcmsstaging.stchas.edu/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:President's%20Office%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu/api/content/query/+contentType:Departments%20+Departments.Name:President's%20Office%20+languageId:1%20+deleted:false%20+live:true

 

So I’m not sure what the difference is when I build my url in the powershell script, but it’s not working properly.

 

So when I build my final url before submitting it through the Invoke-WebRequest commandlet I’m doing this to concatenate the different url parts together into the final url which will be subnmitted like this:

 

        $dprtmntSrchUrlPt1 = "<a href="https://dotcmsstaging.stchas.edu:443/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:">https://dotcmsstaging.stchas.edu:443/api/content/query/+contentType:Departments%20+Departments.Name:"

        $dprtmntSrchUrlPt3 = "*%20+languageId:1%20+deleted:false%20+live:true"

 

With the dprtmntSrchUrlPt2 variable being my department name string to search with and then concatenating the individual parts together to build the final url looking like this:

 

$dptNameSrchUrl = "{0}{1}{2}" -f $dprtmntSrchUrlPt1, $dprtmntSrchUrlPt2, $dprtmntSrchUrlPt3

 

The –f then formats and concatenates all of the above string variables together to build the final url to be sent to the REST API.

 

The funny thing is when I try to submit the https request through the powershell invoke-webrequest commandlet, as shown above then I keep getting a 401 unauthorized response/status code.

 

Which probably means I don’t have my request exactly right and so the API thinks I’m trying to go to an endpoint that is either protected or doesn’t exist.

 

So I’m not sure what more to check the url for since it looks ok to me, unless the current concatenation process somehow is adding or changing some of the original characters, and thereby pointing the request to an invalid page or endpoint.

 

Any thoughts on what to try next?

 

Henry

 

 

 

 

 

 

 

 

From: [hidden email] [[hidden email]] On Behalf Of Nathan Keiter
Sent: Monday, November 06, 2017 2:41 PM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Since it’s a two word term, have you tried encapsulating it in quotes or asterisks?

 

+Department.name=“President’s Office”

 

+Department.name=“*President’s Office*

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 3:22 PM
To: '[hidden email]'
Subject: [dotcms] Empty REST API Request Results - From https powershell request

 

I have a department in our departments structure which when I search for it using its name through the REST API brings back no contentlets, even though I can log into our backend and see the department listed in the departments structure, with some data.

 

For this reason I’m assuming that there is indeed a contentlet for the department named below and I’m just not formatting my https request properly somehow.

 

The name of the department contains a single-quote and looks like this:

 

President’s Office

 

I’ve tried replacing the single-quote with a %27 to try to properly url encode it and that doesn’t seem to work because I’m still not finding any contentlets for it, in my response, though I am still receiving back a 200 status code.

 

I have also tried converting the single-quote to two single-quotes (‘’) back to back, as well as to a back slash single quote (\’) to try to escape the single-quote, but so far nothing seems to work and bring back any data.

 

I’m actually sending my formatted url request using the Invoke-WebRequest commandlet.

 

Any help would be greatly appreciated.

 

HDV

 

 

 

 

 

 

 

--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/CY4PR0501MB37772028D29B3AABEC88F77FAD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit
https://groups.google.com/d/optout.

--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/058d9bd5ca454fe0a72b2521d061d62d%40exch13c.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB377716D5B72F58F8DC682F70AD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/4c0491a3d05743a79c81bf464ec83dba%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Empty REST API Request Results - From https powershell request

Henry Versemann

OK. I’ll try to get that information.

Thanks.

 

Henry

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Nathan Keiter
Sent: Tuesday, November 07, 2017 7:46 AM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Well, unfortunately I have zero experience using PowerShell program scripts.

 

Could you check the access logs on the dotCMS server and see what URL is actually hitting the server? That might give you a clue as to what is malformed by the script.

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 5:05 PM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Nathan,

 

Will I tried both of those alternatives with no success.

 

So then just to see if I could do it I copied the following 3 url variations into a brand new browser window and hit enter and each one brought back the data that I’m trying to get at. Here are the 3 url variations I used:

 

<a href="https://dotcmsstaging.stchas.edu:443/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:*President's%20Office*%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu:443/api/content/query/+contentType:Departments%20+Departments.Name:*President's%20Office*%20+languageId:1%20+deleted:false%20+live:true

 

 

<a href="https://dotcmsstaging.stchas.edu/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:President's%20Office*%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu/api/content/query/+contentType:Departments%20+Departments.Name:President's%20Office*%20+languageId:1%20+deleted:false%20+live:true

 

 

<a href="https://dotcmsstaging.stchas.edu/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:President's%20Office%20&#43;languageId:1%20&#43;deleted:false%20&#43;live:true">https://dotcmsstaging.stchas.edu/api/content/query/+contentType:Departments%20+Departments.Name:President's%20Office%20+languageId:1%20+deleted:false%20+live:true

 

So I’m not sure what the difference is when I build my url in the powershell script, but it’s not working properly.

 

So when I build my final url before submitting it through the Invoke-WebRequest commandlet I’m doing this to concatenate the different url parts together into the final url which will be subnmitted like this:

 

        $dprtmntSrchUrlPt1 = "<a href="https://dotcmsstaging.stchas.edu:443/api/content/query/&#43;contentType:Departments%20&#43;Departments.Name:">https://dotcmsstaging.stchas.edu:443/api/content/query/+contentType:Departments%20+Departments.Name:"

        $dprtmntSrchUrlPt3 = "*%20+languageId:1%20+deleted:false%20+live:true"

 

With the dprtmntSrchUrlPt2 variable being my department name string to search with and then concatenating the individual parts together to build the final url looking like this:

 

$dptNameSrchUrl = "{0}{1}{2}" -f $dprtmntSrchUrlPt1, $dprtmntSrchUrlPt2, $dprtmntSrchUrlPt3

 

The –f then formats and concatenates all of the above string variables together to build the final url to be sent to the REST API.

 

The funny thing is when I try to submit the https request through the powershell invoke-webrequest commandlet, as shown above then I keep getting a 401 unauthorized response/status code.

 

Which probably means I don’t have my request exactly right and so the API thinks I’m trying to go to an endpoint that is either protected or doesn’t exist.

 

So I’m not sure what more to check the url for since it looks ok to me, unless the current concatenation process somehow is adding or changing some of the original characters, and thereby pointing the request to an invalid page or endpoint.

 

Any thoughts on what to try next?

 

Henry

 

 

 

 

 

 

 

 

From: [hidden email] [[hidden email]] On Behalf Of Nathan Keiter
Sent: Monday, November 06, 2017 2:41 PM
To: [hidden email]
Subject: [dotcms] RE: Empty REST API Request Results - From https powershell request

 

Since it’s a two word term, have you tried encapsulating it in quotes or asterisks?

 

+Department.name=“President’s Office”

 

+Department.name=“*President’s Office*

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: [hidden email] [[hidden email]] On Behalf Of Henry Versemann
Sent: Monday, November 06, 2017 3:22 PM
To: '[hidden email]'
Subject: [dotcms] Empty REST API Request Results - From https powershell request

 

I have a department in our departments structure which when I search for it using its name through the REST API brings back no contentlets, even though I can log into our backend and see the department listed in the departments structure, with some data.

 

For this reason I’m assuming that there is indeed a contentlet for the department named below and I’m just not formatting my https request properly somehow.

 

The name of the department contains a single-quote and looks like this:

 

President’s Office

 

I’ve tried replacing the single-quote with a %27 to try to properly url encode it and that doesn’t seem to work because I’m still not finding any contentlets for it, in my response, though I am still receiving back a 200 status code.

 

I have also tried converting the single-quote to two single-quotes (‘’) back to back, as well as to a back slash single quote (\’) to try to escape the single-quote, but so far nothing seems to work and bring back any data.

 

I’m actually sending my formatted url request using the Invoke-WebRequest commandlet.

 

Any help would be greatly appreciated.

 

HDV

 

 

 

 

 

 

 

--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/CY4PR0501MB37772028D29B3AABEC88F77FAD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit
https://groups.google.com/d/optout.

--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dotcms/058d9bd5ca454fe0a72b2521d061d62d%40exch13c.ms.gettysburg.edu.
For more options, visit
https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB377716D5B72F58F8DC682F70AD500%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/4c0491a3d05743a79c81bf464ec83dba%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CY4PR0501MB377722A0EDD4923E6F174B6EAD510%40CY4PR0501MB3777.namprd05.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.