// ServiceNow

Scripted REST APIs

code

An example for the POST method of Scripted REST APIs.

(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {

    // implement resource here
  try{
  
    var data = request.body.data;
    //istek sonunda karşıya gönderilecek Json içerik
    var body = {};	
    
    body = createRecord(data);
    
      
      //işlem sonunda karşıya gönderilecek Json içerik ve Kod
      response.setBody(body);
      response.setStatus(201);		
    
  } catch(e) {
    var error = new sn_ws_err.ServiceError();
    error.setStatus(201);
    error.setMessage('FAILURE');
    error.setDetail(e.toString());
    return error;		
  }

  function createRecord(data){
    var localBody = {};	
    
    //Glide İşlemleri +
    //Glide İşlemleri -
    
      //Bu fonksiyon için karşıya gönderilecek Json içerik detayları
      localBody.status = "Status: SUCCESS";
      localBody.number = data.number;		
    
    return localBody;
  }
  
})(request, response);

 

// FEEDBACK

Was this useful?

Your rating shows how helpful this note is to other readers.

Was this useful?

Click the stars to rate.

Average rating 0 / 5. Total votes: 0

No one has rated this post yet. Be the first!

Sorry this post was not helpful.

Your feedback is valuable to us.

How can we make this post more helpful?

// JOIN THE CONVERSATION

Share your experience

Got a question, a different solution or a note to add?

// KEEP READING

One more note.

All posts ↗︎