List table records¶
Overview¶
Retrieves multiple records from the specified table.
Path parameters¶
| Name | Description |
|---|---|
baseurl |
The absolute base URI for the request (this is the same for all requests) including: the schema, the domain, and a path fragment. |
table |
The table name of for the operation. |
Optional query parameters¶
| Name | Type | Possible values | Description |
|---|---|---|---|
DisplayValue |
tableapi.DisplayValue2 |
tableapi.DisplayValue2True, tableapi.DisplayValue2False, or tableapi.DisplayValue2All |
Determines the type of data returned, either the actual values from the database or the display values of the fields. |
ExcludeReferenceLink |
bool |
N/A | Flag that indicates whether to exclude Table API links for reference fields. |
Fields |
[]string |
N/A | List of fields to include in the response. |
QueryNoDomain |
bool |
N/A | Flag that indicates whether to restrict the record search to only the domains configured for the logged in user. |
View |
tableapi.View2 |
View2Desktop, View2Mobile, or View2Both |
UI view for which to render the data. |
Limit |
int |
N/A | Maximum number of records to return. |
NoCount |
bool |
N/A | Flag that indicates whether to return the number of rows in the associated table. |
Offset |
int |
N/A | Starting record index for which to begin retrieving records. |
Query |
string |
N/A | Encoded query used to filter the result set. |
QueryCategory |
string |
N/A | Name of the category to use for queries. |
SuppressPaginationHeader |
bool |
N/A | Flag that indicates whether to remove the Link header from the response. |
Required query parameters¶
N/A
Examples¶
package main
import (
"context"
"fmt"
"log"
servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go"
tableapi "github.com/michaeldcanady/servicenow-sdk-go/table-api"
)
func main() {
// Step 1: Create credentials
cred := credentials.NewBasicProvider("{username}", "{password}")
// Step 2: Initialize client
client, err := servicenowsdkgo.NewServiceNowServiceClient(
servicenowsdkgo.WithAuthenticationProvider(cred),
servicenowsdkgo.WithURL("https://{instance}.service-now.com"),
)
if err != nil {
log.Fatal(err)
}
// Step 3: Configure request
listConfig := &tableapi.TableRequestBuilder2GetRequestConfiguration{
QueryParameters: &tableapi.TableRequestBuilder2GetQueryParameters{
// Optional configurations
},
}
// Step 4: Execute request
list_response, err := client.Now2().TableV2("{TableName}").Get(context.Background(), listConfig)
if err != nil {
log.Fatal(err)
}
}
package main
import (
"context"
"fmt"
"log"
servicenowsdkgo "github.com/michaeldcanady/servicenow-sdk-go"
tableapi "github.com/michaeldcanady/servicenow-sdk-go/table-api"
)
func main() {
// Step 1: Create credentials
cred := credentials.NewBasicProvider("{username}", "{password}")
// Step 2: Initialize client
client, err := servicenowsdkgo.NewServiceNowServiceClient(
servicenowsdkgo.WithAuthenticationProvider(cred),
servicenowsdkgo.WithURL("https://{instance}.service-now.com"),
)
if err != nil {
log.Fatal(err)
}
// Step 3: Define raw URL
rawURL = "https://https://{instance}.service-now.com/api/now/v1/table/{TableName}"
// Step 4: Build request
collectionRequestBuilder = tableapi.NewDefaultTableRequestBuilder2(rawURL, client.RequestAdapter)
// Step 5: Configure request
listStdConfig := &tableapi.TableRequestBuilder2GetRequestConfiguration{
QueryParameters: &tableapi.TableRequestBuilder2GetQueryParameters{
// Optional configurations
},
}
// Step 6: Execute request
list_std_response, err := collectionRequestBuilder.Get(context.Background(), listStdConfig)
if err != nil {
log.Fatal(err)
}
}